Back here, talking about my journey learning Ruby and Rails.
What would be Rails without TDD? And what is TDD? BDD? Test Driven Development and Behaviour Driven Development… Well, I won’t explain these 2 concept here, there is Pliny of articles about it: http://en.wikipedia.org/wiki/Test-driven_development
So I began learning about TDD and BDD and what is the common way to do this in Rails… RSpec is the answer!
As I’ve been working with traditional Java/J2EE/RUP way of life, when I first read: write your test first, I thought: what the fuck? And my first steps (beside learning how works RSpec) were:
- Create a test! Done! It fails! Great!!
- Write some code (a rails model)! Done! The test succeeded! Great!!!
- Think about what must be the behaviour of the model! Great!!
- Write the code before the test! DAMN!!!!
So It’s gonna be hard… Bad habits.. But This is the way to go, trust me!