Faster Prettier RubyKoans

August 25, 2010

Hopefully you have heard about RubyKoans, - a great tool for improving your ruby knowledge. RubyKoans is based on a series of increasingly difficult lessons which themselves are nothing more than failing unit tests that need a little help of your help to pass.

When you run the test suite the RubyKoans Sensei will tell expect you to fix the one little test that is preventing you from gaining enlightenment, so you go ahead open the relevant test and fix it. You run the test suite again using rake, only to find a new test that is between you and Nirvana. Rubykoans is great but we programmers tend to be on the lazy side and being used to wonderful Ruby testing tools such as autotest, I thought about adding autotest support to Rubykoans and while at it figured a way to add color to the output.

Get your colorized autospec enabled rubykoans here

This is how it looks, and you can call it using either using rake or autotest to make your life easier :

rene@linux:~/ruby_koans/koans$ autotest
loading autotest/rubykoan
/usr/bin/ruby1.8  'path_to_enlightenment.rb'

Thinking AboutAsserts
  test_assert_truth has damaged your karma.

You have not yet reached enlightenment ...
<false> is not true.

Please meditate on the following code:
./about_asserts.rb:10:in `test_assert_truth'
path_to_enlightenment.rb:32


mountains are merely mountains

I want to thank Ryan Davis for helping me doing this and for his wonderful testing tools

Comments

comments powered by Disqus