[mocha-developer] stub_everything returning self (was: something else)
John D. Hume
duelin.markers at gmail.com
Sat Nov 1 18:36:12 EDT 2008
I'd probably vote against this feature, but if mocha were going to
offer that sort of message eating behavior, I'd prefer that each
message eater return a new message eater that knew what method it was
the return value for, the benefit being that it could report that in
to_s and/or inspect (rather than have you scratching your head at how
such-and-such a piece of code got a hold of the stub you passed to
On Sun, Oct 26, 2008 at 9:22 PM, John Wilger <johnwilger at gmail.com> wrote:
> Where it comes in handy is when you have to work with poorly written
> dependencies that violate LoD and you don't have a good way to either
> replace them or adapt them. It definitely should /not/ be the default
> behavior to return self, but the option to do so would be helpful in some
> On Oct 26, 2008, at 2:38 PM, Jay Fields <jay at jayfields.com> wrote:
>> I'm not sold on stub_everything returning self. Generally you only want
>> that kind of behavior if you violate the law of demeter. There are cases
>> where this is desirable, but they are few and far between in my experience.
>> Changing mocha to help you violate the law of demeter seems like a bad idea.
>> Although, I guess you could argue that people should be given all the rope
>> they want.
More information about the mocha-developer