[rspec-users] Four Question From an RSpec Baby - Give me something to chew

Nick Hoffman nick at deadorange.com
Thu Sep 4 19:14:54 EDT 2008


On 2008-08-27, at 15:25, Mark Wilden wrote:
> The other thing I would say is that mocking and stubbing are  
> powerful tools that you should add to your arsenal as soon as  
> possible. I've had several coworkers who resisted using them, only  
> to finally achieve that "aha!" moment later. Your tests get easier  
> to write, and they're less brittle to change.

G'day Mark. I was re-reading this thread and noticed this paragraph of  
yours. I've been using RSpec and BDD for about 2 months now, and love  
it.

However, I'm not a fan of mocking and stubbing, primarily for two  
reasons:
1) I believe that specs should test behaviour, rather than a  
behaviour's implementation.
2) Using mocks and stubs causes your specs and implementation to be  
tightly coupled, which often forces you to modify your specs if  
changes occur in the implementation.

However, #2 contradicts what you said about "tests ... [are] less  
brittle to change" when using mocks and stubs. Considering that I'm  
still very new to mocks and stubs, I'm probably missing something  
here. When you have a minute, would you mind countering me?

Thanks!
Nick


More information about the rspec-users mailing list