Created
February 27, 2012 17:27
-
-
Save developwithpassion/1925656 to your computer and use it in GitHub Desktop.
RSpec Matchers for developwithpassion_fakes
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
module RSpec | |
Matchers.define :have_received do|symbol,*args| | |
match do|fake| | |
result = true | |
method = fake.received(symbol) | |
result &= method != nil | |
unless (args.count == 0) | |
result &= method.called_with(*args) != nil | |
end | |
result | |
end | |
end | |
Matchers.define :never_received do|symbol| | |
match do|fake| | |
fake.never_received?(symbol) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment