Skip to content

Instantly share code, notes, and snippets.

@mguterl
Created January 27, 2011 13:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mguterl/798513 to your computer and use it in GitHub Desktop.
Mailer.should deliver(:job_application).with(@job.id, @user.id)
message = double
message.should_receive(:deliver)
Mailer.should_receive(:job_application).with(@job.id, @user.id).and_return(message)
RSpec::Matchers.define :deliver do |message|
chain :with do |*args|
@with = args
end
match do |mailer|
mail = double
mail.should_receive(:deliver)
mailer.should_receive(message).with(*@with).and_return(mail)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment