Skip to content

Instantly share code, notes, and snippets.

@skwp
Created October 30, 2013 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skwp/7226933 to your computer and use it in GitHub Desktop.
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.
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