Re: TDD vs BDD

The sd.rb podcast has a decent episode on it. I recommend watching that.

Railscasts - Free Ruby on Rails Screencasts

22

Re: TDD vs BDD

One is to keep it from hitting the database and slowing your tests down. A more important reason to mock or stub is to decouple portions of your examples. So, in Rails, you don't need to test AR to test that a controller is behaving correctly. Or, going to my example before, you can specify a method that behaves differently depending on whether the user is logged in by stubbing the authenticated? method to return exactly what moves the controller to handle that case.

Have a look at my blog post: http://calicowebdev.com/blog/show/14.