Created
October 30, 2013 03:45
-
-
Save skwp/7226933 to your computer and use it in GitHub Desktop.
An example of using an RSpec matcher as a duck-typed attribute matcher in a message expectation.
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 :user_with_email do |email| | |
match do |user| | |
user.email == email | |
end | |
end | |
it "subscribes the user to contest" do | |
# ... do something to cause the contests subscription to happen... | |
Reverb::Contests::Subscription.should have_received(:create).with(user_with_email("foo@bar.com)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment