[mocha-developer] Removing/overriding/unstubbing a stub?
lists-mocha at shopwatch.org
Fri Sep 14 13:26:02 EDT 2007
On 9/13/2007 7:32 AM, James Mead wrote:
> Personally I'm not a big fan of the setup method. I agree with Duncan
> that two separate test cases is one way to go. Alternatively you could
> move the stubbing out of the setup method and into invidual test
> methods and only add it to the ones that need it - I think this has
> the benefit of being clearer and more explicit, but it will depend a
> bit on how many test methods need the stubbed method.
Yeah, that's how we initially coded it, but calling the same stub 25
times out of 28 tests felt pretty nasty!
But for me, refactoring the test (and probably the functionality) into
two classes solves the problem so far. I'll yell again if there's a
case where it doesn't or where I wish it weren't needed.
More information about the mocha-developer