Action Mailer Previews (since Rails 4.1)
Since Rails 4.1 there is a preview-function to see what an e-mail will look like.
Integration to RSpec
All you need to do is implement a preview-class in spec/mailers/previews/notifier_preview.rb
:
Copyclass NotifierPreview < ActionMailer::Preview def welcome Notifier.welcome(User.first) end end
And change adjust the preview load path in your application.rb
:
Copyconfig.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews"
Then a preview will be available in the browser at http://localhost:3000/rails/mailers/notifier/welcome as well as a list of previews at http://localhost:3000/rails/mailers .
Rails <4.1
You could use Mailcatcher.
Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.