[rspec-users] Mocking: brittle specs and tight coupling?

Phlip phlip2005 at gmail.com
Sun Apr 12 11:32:11 EDT 2009

> The third alternative is you never _need_ to mock, yet both your tests 
> and target code are highly decoupled. _That_ is the goal.

Another tip: To TDD a new feature, don't clone a high-level test which calls 
code which calls code which calls the code you need to change.

Start by cloning the lowest level test possible. If there is none, write one. 
And if the test still wouldn't be low level enough, start by refactoring the 
line you need to change, to pull it out into a method you can test directly.

More information about the rspec-users mailing list