Created
May 29, 2009 15:35
-
-
Save lmarburger/120010 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 ActiveSupport::TestCase | |
# Create a be_a / be_an matchy matcher. | |
# @video.should be_a(Video) | |
# @video.should_not be_an(Octopus) | |
custom_matcher :be_a do |receiver, matcher, args| | |
expected = args[0] | |
matcher.positive_failure_message = "Expected #{ receiver.inspect } to be a #{ expected.inspect }." | |
matcher.negative_failure_message = "Expected #{ receiver.inspect } to not be a #{ expected.inspect }." | |
receiver.is_a? expected | |
end | |
alias :be_an :be_a | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment