Skip to content

Instantly share code, notes, and snippets.

@thechrisoshow
Created June 17, 2011 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thechrisoshow/1031144 to your computer and use it in GitHub Desktop.
Save thechrisoshow/1031144 to your computer and use it in GitHub Desktop.
Testing email delivery in Rails 3 vs Rails 2
# Using rspec mocking:
# Rails 2 method:
UserMailer.should_receive(:deliver_signup)
# Cumbersome Rails 3 method:
mailer = mock
mailer.should_receive(:deliver)
UserMailer.should_receive(:signup).and_return(mailer)
@maletor
Copy link

maletor commented Aug 16, 2011

This doesn't work.

@thechrisoshow
Copy link
Author

Woops, should've said and_return.

Did that fix it for ya?

@maletor
Copy link

maletor commented Aug 16, 2011 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment