Unit Testing in Ruby
First, Jim Weirich has posted his slides and Ruby-centric perspective of OSCON. Well worth checking out.
For today, I’ve taken a look at unit testing in Ruby. I took a simple task (Atom’s processing model for content), and implemented it in Ruby. Unsurprisingly, REXML makes it easy.
Even so, test cases are always a good idea. Ruby’s unit testing support seems to follow in the path pioneered by JUnit, and emulated by many others. As is often the case, lines of code in the test cases in this example outnumber the lines of code in the implementation.
RDoc can also be used to produce pretty documentation of the code and the tests.