Allow unstubbing of methods
-
Deleted User
- I should mention that I was not able (with almost no effort) to
implement unstub_any
- I would expect both to revert
- Dunno
- My expectation would be that the moment you unstub, all your expectations should have been met.
- I should mention that I was not able (with almost no effort) to
implement unstub_any
-
Jamie Phelps
I was looking for this exact functionality for unstubbing from
any_instanceand I think that providing at least a block-enabled variant is the way to go. Here are my answers:I think
stubsmethod is good because it's accepting a hash. It could almost be written asstubs=afaiac.I think
unstubis a transitive method as in "unstub this method" so, I think it should beunstub(*methods)Yes, I'd say unstub all stubs of a method. If folks felt strongly, a variant could be added that accepts an array or hash of
withoptions for further targeting.Not sure about 3. Maybe I don't properly understand the question.
Agree with kwerle on 4.
-
Alex
I created a fix for this - http://github.com/alexheaton/mocha (alexheaton/unstubs or master branches)
I'd really welcome some feedback, I'm sure there are things that need improving. For instance, I may have missed some testing edge cases, or perhaps my tests are dirty (I normally use RSpec).
-
James Mead
I think this message [1] from Adam Cigánek on the Mocha mailing list is also relevant here.
[1] http://groups.google.com/group/mocha-developer/browse_thread/thread...
-
James Mead
- State changed from new to open
-
James Mead
- State changed from open to resolved
I've just pushed up changes to add Mocha::ObjectMethods#unstub. So I'm closing this ticket.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.