Ruby + proper specifications = rSpec

I had an enlightenment today – truly an enlightenment.

After months of reading and getting to know what test driven development and extreme programming is all about, I have finally been able to practice what I preach. Since I work with several programmers and the product we are writing is so new that it is still in diapers (famous hebrew saying). Quality control is a demand from above management, after they got burned with too many escalations with the existing product. So part of my job description was preaching unit testing and such.

Anyways – I really did understand and could quote all the reasons why testing is important, and why its a sort of a documentation, and why it should be done before coding, and why it makes coding more structured and disciplined and gives the programmer a direction. But I could not make myself understand how to implement it with ruby’s Test::Unit for example, not even talking about more obscure implementations of xUnit like CppUnit which is something that was chosen for our project.

Last week I saw the presentation Dave Astels made at google, freely downloadable from google video. An I saw that it was god (with one ‘o’). And today I finally got to trash all the beginnings that I tried to do with Test::Unit on the ClearCase wrapper I’m writing – and started doing rSpec instead.

It flowed… like a river. And any bumps that were on the were not frustrating, they were annoying, thus actually motivating me to kick them of my route and continue flowing with the flow without any frustration. It rocks. I love it.

Still the one thing I miss with all this TDD and BDD are good concrete examples that are a bit more than what rSpec examples are, I need it chewed and digested for extreme easy understanding. Maybe a step-by-step evolving kind of code, maybe even a book matching the Progmatic books quality is the thing missing in all of this. Because it always looks really great – but when a motivated but inexperienced programmer like me tries to implement this stuff it soon becomes frustrating. Even though rSpec is not too frustrating, and hopefully it will only grow to be easier and more intuitive and productive like it is already in its alpha(?) state.

Enough ramblings for now – back to the code! 🙂