[Rspec-devel] define_instance_method, stub_with, and mock_with
lists-rspec at shopwatch.org
Mon Sep 4 15:41:56 EDT 2006
David Astels wrote:
> On 27-Aug-06, at 4:51 PM, David Chelimsky wrote:
>> I also
>> have yet to see a case where using partial mocks is a better
>> decision than improving the decoupling in the system under test.
> I agree. Partial mocks can get very confusing, very easily.
OK, but what about partial stubs? It's particularly handy to stub out
Time.now, f'rinstance, so that all your expectations run at a particular
"now", matching up with timestamps in fixtures, etc. There's no way to
do that via an API that requires you to create new instance objects for
your mocks. And I don't imagine you're suggesting that I decouple an
app by asking for "time_handler" at startup...
Also, FWIW, it sounds like Mocha is likely to become included in (or at
least used by) Rails core:
I guess, depending on your viewpoint, that's either good for, bad for,
or irrelevant to this discussion and rspec in general.
More information about the Rspec-devel