Skip to content

Instantly share code, notes, and snippets.

@mguterl
Created Jan 27, 2011
Embed
What would you like to do?
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