0

In ActiveAdmin I have setup a small form for sending bulk emails to users. In the form I have the option to parse text using html or markdown. I have two different views and depending on the content type attribute of the email, one of the two is rendered. I pass the @content of the email to the views and in the one I call simple_format @content and in the other - a helper method markdown @content. So the question is - how do I test the email views. Everywhere I see ways to preview emails in the browser, but I want to have some written tests, which I can run along with my full test suit. So far, the only idea I have come up with is to use Capybara and something like:

visit '/mail_view'
expect(find 'a.reset_password').to contain reset_password_path(user)

Is this the way to go or is there another standard?

Alexander Popov
  • 23,073
  • 19
  • 91
  • 130
  • Have you tried inspecting the contents of ActionMailer::Base.deliveries? – Dave Schweisguth May 24 '14 at 16:00
  • possible duplicate of [Rails - How do you test ActionMailer sent a specific email in tests](http://stackoverflow.com/questions/2063438/rails-how-do-you-test-actionmailer-sent-a-specific-email-in-tests) – Dave Schweisguth May 24 '14 at 16:00

0 Answers0