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.
Tiscali is shit (oh, and monitor your web page load times with Ruby)
February 5th, 2008
UPDATE: apparently the inconsiderate bastard claiming ownership of my ADSL pipe is, in fact, quite entitled to do so - it's my ISP, Tiscali. Their bandwidth throttling is apparently a bit over-zealous. The Reg has more details on it - it's unusual of me to not follow their RSS feed but work has kept me busy lately. Suffice to say I won't be with Tiscali much longer.
Previous article follows...
Read the rest of this entryTeaching BDD by pair-programming
December 17th, 2007
Recently (last few months) I've had the opportunity to show two developers some BDD techniques. The first was in Ruby, using RSpec (new URL!), the second was in C# using MbUnit and Rhino Mocks. Here are my observations about the process. This is quite a long post, and strays a bit into the technical details that can become obstacles to teaching BDD, but I decided to include as much as possible to emphasise just how tough I found it.
Read the rest of this entrySix lines of (Java) code that do (almost) nothing
November 4th, 2007
I normally try to avoid anything that sounds like Java-bashing - every language has faults, and often the real accusation should be aimed the people using languages well past their sell-by date for things they were not designed for. But trying to decipher some of the examples in Patterns of Enterprise Application Architecture makes me want to scream. He does explain that he chose Java and C# for accessibility, but it definitely doesn't help clarity, like this extract from page 224 (Compound Key):
Read the rest of this entryRake task for heckling your specs
November 1st, 2007
Drop this into your Rakefile and let the heckling begin!
Read the rest of this entrySpecifying dynamic gem usage with RSpec
October 31st, 2007
Between me and the helpful folk at rspec-users, I managed to come up with a solution to specify that a gem is loaded and used in a library. This is for the case where you don't want the gem loaded all the time, or where you can put the loading in a method called at some point (as opposed to just at the top of a file) - although I'm sure it could be adapted.
Read the rest of this entryBehaviour-driven database ORM with RSpec stories
October 27th, 2007
Now, it is a widely known fact, among possibly half of my six subscribers, that I'm working on an ORM and database migration package for Rubyists that will kick ActiveRecord into the floor. Not that I don't have some respect for the library - it has, after all, seriously raised the bar in terms of user (ie webapp developer) simplicity. But it suffers some serious architectural faults, and has begun to outgrow the spirit of the ActiveRecord pattern (obligatory Fowler link). I am not the only person who thinks so either, some people such as Matthew at PlayLouder are far more frustrated than me.
Read the rest of this entry