With two small children at home I’ve lately been trying to get in about an hour of coding around lunch. These days thats Ruby on Rails and RSpec. I spent about half an hour today trying to figure out why RSpec was failing on the following:
Seemed reasonable especially since the following passed fine:
These were really simplified examples I came to after about the first 15 minutes. Turns out I found the answer by paying closer attention to the RSpec API. It turns out should_be calls the equal? method not the == method. Worked fine with:
I’m enjoying trying out RSpec with Rails so far, though the startup time to run the specs is about 8-10 seconds on my laptop which is a bit annoying.