The Princess and the Pea, as a Cucumber Feature

Kent Beck tweeted:

User story: “As a princess I want to confirm my royalty so I get bruised after sleeping on 40 mattresses over a pea”. Just tell real stories”

That sounded so much like a Cucumber feature that I decided to write it as one:

How to make Machinist and Autotest coexist

If you’ve tried to use Machinist and autotest (part of ZenTest) you have probably seen this exception that prevented you from using it:

It’s discussed in the machinist Google Group as well.

It’s because of a wacky hack that’s part of Machinist that overrides so you can do, but ZenTest expects to do what it does normally.

I have a fix for this.
Continue reading “How to make Machinist and Autotest coexist”

Using RVM to install REE 1.8.7-2009.10

I’m trying out Ruby Version Manager this week, and my first impression is that this is some cool technology. But I wasn’t able to figure out how to get it to install an older version of REE to get around this bug (the “Marshal.load reentered at marshal_load” issue).

Igor P’s solution is correct (just install REE 1.8.7-2009.10), but it took a little fiddling to figure out how to get RVM to use the older version of REE. Here’s how to do it:

Proper Error Handling in Rails Controllers

Rails controllers can get out of hand if you’re not very careful. Skinny Controller Fat Model is a great start. But what about handling errors? Isn’t it enough to just let Rails catch your exception and show a 500 Server Error page?

No, it’s not. Falling back on 500 Server Error for everything outside of the “happy path” through your code is sloppy coding.
Continue reading “Proper Error Handling in Rails Controllers”

A Cucumber step to test for a YM4R Google Map

I had some problems with a view in a Rails app that was conditionally hiding a Google Map that was generated using the YM4R plugin. I don’t usually test views in unit tests, and this logic depended on a particular situation with the data behind the view, so I decided that this would be a good candidate for a Cucumber feature.

Here’s the Cucumber step implementation I wrote.
Continue reading “A Cucumber step to test for a YM4R Google Map”