Created
December 4, 2009 18:56
-
-
Save maiha/249252 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
| Spec::Matchers.define :be_extension_of do |expected| | |
| match do |obj| | |
| (class << obj; self; end).ancestors.include?(expected) | |
| end | |
| end | |
| obj = Object.new | |
| obj.should be_extension_of(Kernel) # => true | |
| obj.should be_extension_of(Spec) # Spec::Expectations::ExpectationNotMetError | |
| obj.extend(Spec) | |
| obj.should be_extension_of(Spec) # => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment