Hi David

On 18 Mar 2008, at 08:15, David Schmidt wrote:

> Here is his email to me, less his signature as I don't want to make  
> this personal. I'd like to see what the RSpec user community has to  
> say in response to his comments, below:

[snip email]

For me, it basically boils down to: use whichever is appropriate for  
what you're testing, as long as it provides good coverage and makes  
the tests easy to write. If the tests are hard to write, and you're  
mocking/stubbing all over the place, it's a smell that your  
implementation is probably not loosely coupled enough - perhaps you  
need to refactor.

Mocks are a very useful testing construct, but using them religiously  
everywhere is as bad as not using them religiously, IMHO.

Have you read Mocks aren't Stubs[1]? It's a very good treatise on the  
advantages and disadvantages of using mocks in testing. Pat Maddox  
also wrote an article on this subject recently that I found very  
helpful[2].

Thanks
Chris

[1] http://martinfowler.com/articles/mocksArentStubs.html
[2] 
http://evang.eli.st/blog/2008/2/3/it-s-not-about-state-or-interactions-it-s-about-behavior

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to