Created
June 11, 2010 15:42
-
-
Save gcao/434658 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "around advice" do | |
advice = Klass.a4r_data[:test][0] | |
advice.around?.should be_true | |
o = Klass.new | |
o.expects(:a4r_invoke).with(:proxy, 1) | |
advice.invoke(o, :proxy, 1) | |
o.value.should == %w(around(before) around(after)) | |
end | |
it "before advice" do | |
advice = Klass.a4r_data[:test][1] | |
advice.before?.should be_true | |
o = Klass.new | |
advice.invoke(o, 1) | |
o.value.should == %w(before) | |
end | |
it "after advice" do | |
advice = Klass.a4r_data[:test][3] | |
advice.after?.should be_true | |
o = Klass.new | |
advice.invoke(o, 1, 1).should == 100 | |
o.value.should == %w(after) | |
end | |
it "test method without advices" do | |
Klass.a4r_disable_advices_temporarily :test do | |
o = Klass.new | |
o.test 1 | |
o.value.should == %w(test) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment