Created
November 8, 2009 10:25
-
-
Save maiha/229201 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
| class Foo | |
| def a | |
| end | |
| private | |
| def b | |
| end | |
| end | |
| Foo.new.should respond_to(:a) # passed | |
| Foo.new.should respond_to(:b) # failed # 'd like to pass this | |
| Foo.new.should respond_to(:c) # failed |
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
| Spec::Matchers.define :provide do |expected| | |
| match do |obj| | |
| (obj.public_methods + obj.protected_methods + obj.private_methods).include?(expected.to_s) | |
| end | |
| end | |
| Foo.new.should provide(:a) # passed | |
| Foo.new.should provide(:b) # passed | |
| Foo.new.should provide(:c) # failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment