Best resources for learning TDD with Rails [closed]
I've finally gotten a handle on rails, and feel comfortable enough with it to start learning best practices, with the first on my list being TDD principles. What are the best resources to learn about TDD with Rails? Books, tutorials, anything. I'm hungry to learn!
If you want to buy a book, I would suggest you to look at pragmatic rails test prescriptions . It's not stuck with an implementation as the rspec book is and will more probably let you choose the tools YOU want.
I feel it is also better to read this book than million posts where pro/con BDD/TDD are spinning around ;)
Have a look at this one: http://pragprog.com/titles/achbd/the-rspec-book
My usual answer involving Rails and learning usually ends up at Railscasts. Check out the testing section. While there's not one specifically on TDD, most of them touch on the subject. Especially Cucumber, etc.
I would suggest you focus on the basics here! Don't fall in love with any specific way of doing TDD like rspec, shoulda or similar. Wait with that part until you understand the basics of rails TDD - THEN you can go out and add testing tools to your toolbox.
Start by writing a simple test for some part of your app where the logic does something else than CRUD work, some place where you handle some kind of math, or weird user behavior and try to write a test for that case - but make sure you have the time for it, because it will require much more time than expected the first time.
Once you have that test case running and working - and you fully understand why, then your ready to expand and start to play with all the wonderful testing tools out there.
精彩评论