From duelin.markers at gmail.com Sat Nov 1 18:36:12 2008 From: duelin.markers at gmail.com (John D. Hume) Date: Sat, 1 Nov 2008 18:36:12 -0400 Subject: [mocha-developer] stub_everything returning self (was: something else) In-Reply-To: <70D9E647-A83F-4B6E-970C-AA12ACDCDA68@gmail.com> References: <1A4AE300-95AF-4F7A-A099-65871DD07832@gmail.com> <62EE37E7-2910-4589-9553-91B2D2332A5D@gmail.com> <20EDDE95-0A45-41A1-8933-65375D034997@gmail.com> <1db558f00810261216g20085a6euad57b81534b9be36@mail.gmail.com> <70D9E647-A83F-4B6E-970C-AA12ACDCDA68@gmail.com> Message-ID: 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 something-or-other). -hume. On Sun, Oct 26, 2008 at 9:22 PM, John Wilger 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 > cicumstances. > On Oct 26, 2008, at 2:38 PM, Jay Fields 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. -- http://elhumidor.blogspot.com/