Created
June 26, 2012 13:50
-
-
Save suweller/2995882 to your computer and use it in GitHub Desktop.
Rspec - Inheritance matcher
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
RSpec::Matchers.define :inherit_from do |superclass| | |
match do |klass| | |
klass.class.ancestors.include? superclass | |
end | |
failure_message_for_should do |klass| | |
"expected #{klass.class.name} to inherit from #{superclass}" | |
end | |
failure_message_for_should_not do |klass| | |
"expected #{klass.class.name} not to inherit from #{superclass}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment