Ben Emson, one of the founders of the rapidappsgroup has recently written this excellent tutorial on RSpec.
testing
Ruby on Rails - testing generic searching
I thought I'd been clever by writing a search function into my Ruby controllers that could pretty much take any valid search from a web page and convert it into a generic search by converting the parameters into conditions which Ruby then turns into SQL (thus avoiding the risk of sql injection). It seemed like a good idea at the time as I was writing quite a complex cost management tool and rather than write umpteen different search methods, a single catch-all method that could handle simple equality parameters seemed prefereable.
Ruby on Rails - empty string to_i
Just spent an hour wondering why tests were failing, partly my stupidity and partly the way Ruby handles .to_i on empty strings. I'd assumed that calling .to_i on an empty string would generate an error:
x = ""
x.to_i
However "".to_i resolves as zero
Ruby on Rails not rendering HTML in browser
I've just spent an hour tracking down this odd behaviour. The HTML returned when a _form partial created by rails scaffold for 'company' objects was not rendering in the browser when served from our live server i.e. when users tried to edit or create a new company the browser was displaying the HTML as text. In test (on my laptop) the form was displaying as expected.
After a bit of tinkering - basically removing section of the form code until it worked - I realised that some tired developer, I suspect myself, had put in a checkbox for a method that didn't exist:

