How to test email sending using Rspec?
11,437
email-spec looks like a good library
http://github.com/bmabey/email-spec
Author by
marcgg
Trying to build useful software. Find me on twitter or give my blog a read!
Updated on June 12, 2022Comments
-
marcgg almost 2 years
What are the best practices and tools to test email-sending using rspec with Rails?
For instance, how do I test that an email has been sent or what should I test to have efficient testing and acceptable coverage.
If you guys need an example, how would I go and test this:
class UserMailer < ActionMailer::Base def jobdesc_has_been_reviewed(user, title) @body[:title] = title @body[:jobdesc] = jobdesc @body[:url] = "http://" + user.account.subdomain + "." + Constants::SITE_URL + "/jobdescs/#{jobdesc.id}" end end