How to test email sending using Rspec?

Viewed 11570

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
2 Answers
Related