How to test mailers in Rails without tearing your hair out
I was really frustrated that every time a mailer test failed, I’d have to dig through the output of the mail to figure out just where it went wrong. Something it could be something as lame as trailing whitespace on a line, or a newline at the end of the mail.
So I wrote this test-helper which uses unix diff to show you exactly where the difference is. Now testing emails is so much more fun.
Click the title for the code, and just drop it in your test_helper.rb.
Use as per instructions in the code.
1 year ago