A simple log parser for Mailtrap
April 6th, 2008
I just came across a need to test emails sent in a Rails project. It's a RSpec story integration test I'm working on (using Selenium, not a RailsStory), and using ActionMailer in test mode is not good enough. Instead I'm using Matt Mower's handy tool Mailtrap
I created a listener class to start and stop mailtrap as the story runs - which is easy enough - but I needed something to parse the log file from Mailtrap. So I created Mailtrap::LogParser - code available here for anyone that's interested.
As soon as github gives me a beta login, I will fork the Mailtrap repo and add this in. For the mean time, you can use the tarball above.
This is just a stopgap solution really, until Mailtrap has a way of outputting a more structured (and therefore easily-parseable) output.
