Colorizing Rails Test Output «

Code: , , , ,
Comments Off on Colorizing Rails Test Output

I love making things easier to read, to skim, to take in at a glance. At last night’s the ChiRb presentation on rspec I noticed the output was nicely colorized.

Hey, of course that’s easier to read. It’s also dead easy to add to your existing tests thanks to a gem by Pat Eyler, whether you call then with rake test, rake test:units, or ruby test/functional/application_controller_test.rb.

$ sudo gem install redgreen

Edit your test/test_helper.rb and add require 'redgreen' after the other requires, and you’re done. If you run your tests, you’ll see something like:

colorized test output

Passes are green, fails are red, errors are yellow. Here’s hoping you just see lots of green.

And rspec looks like good stuff, I’m going to add it to my test suite for NearbyGamers. The ability to test controllers without testing views (and vice-versa) will be a win.