[Double-ruby-users] Mixing Stubs with Mocks

Mark - mkdynamic markdodwell at gmail.com
Fri Feb 20 17:39:30 EST 2009


Hello!

I want to stub a class method to return a default value, e.g.:

   stub(MyClass).find { 'default' }

And then later on in the test, I want to mock this method with
specific requirements, e.g.:

   mock(MyClass).find(10)

But I don't want to redefine the return value, instead just use
the default provided earlier in the stub.

Is this:

   a) possible
   b) a good idea?

Feedback appreciated!

Thanks,

~ Mark Dodwell





More information about the Double-ruby-users mailing list