[mocha-developer] stubbing in development environment
jason at jasonwatkins.net
Wed Nov 22 05:38:45 EST 2006
Sure. Let's say I have some ruby objects that do i/o with a
distributed system. In the development environment the remote system
isn't available. That gives me two conventional choices:
1.) use a configuration boolean set somewhere to early out
2.) parameterize the constructor to use dependency injection of a mock
Using stubba to override the object directly could be seen as a more
implicit version of #2.
While I understand various folks might object to it on all manner of
philosophical grounds, it's something I'd like to be able to do from
time to time.
On 11/22/06, James Mead <jamesmead44 at gmail.com> wrote:
> On 21/11/06, Jason Watkins <jason at jasonwatkins.net> wrote:
> > Quite happy with mocha for testing. It's been a bit of an eye opener
> > for me, and I expect to begin using it heavily.
> > One other thing I'd like to do is stub out particular class methods in
> > development. Is there a way I can do this with mocha?
> Why do you want to do it? Can you give a concrete example?
> While it would be technically possible, I wouldn't recommend it.
> mocha-developer mailing list
> mocha-developer at rubyforge.org
More information about the mocha-developer