Rhetorical Question

If someone from thoughtbot asks if you’re willing to write a test (or tests) for a patch, that is a rhetorical question. Case and point, a pull request I opened on their airbrake project: https://github.com/thoughtbot/airbrake/pull/1 - Use the Capistrano logger for great justice.

It started off as an innocuous request to change the use of puts in a Capistrano task to use the Capistrano logger. I’m sure after the question “Was I willing to write tests for it?” was posed, I could’ve said “No thanks.” or “Does it really warrant a test?”

I chose the impossible. I chose … Rapture.

It’s not really impossible to test Capistrano tasks, but it’s also not as straightforward as I would have hoped. There are some projects like capistrano-spec that may have helped had airbrake been using RSpec, but no matter. In the end, the 2 line change resulted in a slight re-organization of the Capistrano task and a bunch of test code to assert that the Capistrano logger was doing its job.

Now that’s how you spend a few hours on a Saturday morning!