Created
September 24, 2009 21:34
-
-
Save technicalpickles/193071 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
Spec::Matchers.define :include_module do |mod| | |
match do |instance| | |
mod.instance_methods.inject(true) { |accum, method| accum && instance.respond_to?(method) } | |
end | |
failure_message_for_should do |instance| | |
"expected the class #{instance.class.name} to include the module #{mod}" | |
end | |
failure_message_for_should_not do |instance| | |
"expected the class #{instance.class.name} not to include the module #{mod}" | |
end | |
description do | |
"expected a class to include a mod by responding to all of its methods" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment