[mocha-developer] Removing/overriding/unstubbing a stub?
duncanbeevers at gmail.com
Thu Sep 13 17:03:08 EDT 2007
I think in most cases needing to unstub a method is an indication of
over-reaching setup methods and too-aggressive initial stubbing.
There are some instances however, where I'd like to unstub a method
before teardown. For an example of such a case (good old Time.now)
and a potential approach, see this thread
On 9/13/07, James Mead <jamesmead44 at gmail.com> 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.
> There has been an item on the todo list for a long time about being
> able to "unstub" a method (I think it was first raised by Kevin
> Clark), but not many people have asked for it and we (at Reevoo)
> haven't needed it.
> mocha-developer mailing list
> mocha-developer at rubyforge.org
More information about the mocha-developer