Matthew Bass

Musings on software and life…

May 11th, 2010

Quick ‘n dirty Lindo step for Cucumber

Lindo is great for verifying your Rails tests by opening the HTTP response body in a browser for inspection. It works with most popular testing frameworks including Test::Unit and RSpec. But what about Cucumber?

It’s actually pretty easy to build a custom Cucumber step that triggers Lindo from your cukes. First, install the Lindo gem in your Rails app. Then create features/steps/lindo_steps.rb and insert this code:

Then /^render the current page$/ do
  extend Lindo
  vr
end

The step can be named whatever you like best, but “render the current page” works for me. To trigger Lindo from within your cukes, simply reference the step like so:

Given I am logged in
When I follow "some link"
Then render the current page

When Cucumber hits the last step, the default browser window will open and the contents of the page at that step in the scenario will be displayed. This is very handy when troubleshooting why a specific scenario is failing. It’s also useful for determining what you should be testing for on a given page.

May 9th, 2010

iPhone development

Full Stack iPhone DevelopmentFor the past few months, I’ve been exploring the fascinating world of iPhone development. I have several application ideas and am working pretty hard on getting something to market. My first app will be free, though I hope to work up to a level where I can develop a solid paid app eventually. I’m enjoying learning Objective-C. It’s a mind bender in a lot of ways. Having to handle memory usage, for example. That gets annoying pretty quickly.

My timing has been good since Terralien just launched its own full-stack iPhone development service last week. I’ve enjoyed developing solid Rails-based APIs for iPhones to interact with. I’m looking forward to flexing the skills I’m building on new projects. Learning is fun. The only difficulty is finding the time to learn everything I want to. It’s a never-ending pursuit.

|