Created
March 17, 2009 03:25
-
-
Save smtlaissezfaire/80262 to your computer and use it in GitHub Desktop.
This file contains 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
describe "should respond_to(message1, message2)" do | |
it "passes if target responds to both messages" do | |
Object.new.should respond_to('methods', 'inspect') | |
end | |
it "fails if target does not respond to first message" do | |
lambda { | |
Object.new.should respond_to('method_one', 'inspect') | |
}.should fail_with(/expected #<Object:.*> to respond to "method_one"/) | |
end | |
it "fails if target does not respond to second message" do | |
lambda { | |
Object.new.should respond_to('inspect', 'method_one') | |
}.should fail_with(/expected #<Object:.*> to respond to "method_one"/) | |
end | |
it "fails if target does not respond to either message" do | |
lambda { | |
Object.new.should respond_to('method_one', 'method_two') | |
}.should fail_with(/expected #<Object:.*> to respond to "method_one", "method_two"/) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment