<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On 27 Mar 2007, at 11:19, aslak hellesoy wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">What's Test::Unit mocks?</FONT></P></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Ah sorry, by which I mean the /test/mocks/<env>/mocked_code.rb setup in a default Rails skeleton - it lets you drop a replacement for a method that appears higher up in the search path and allows you to completely over-ride a method.</DIV><BR><BLOCKQUOTE type="cite"> <P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">and just replace the encoded? instance method for all objects that</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">might use it to just return true.</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">Any ideas?</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">You can submit a feature request - ideally with a failing spec to</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">illustrate what you want.</FONT></P> </BLOCKQUOTE><BR></DIV><DIV>After a bit of digging around it looks like David (Chelimsky) has already submitted such a feature request</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><A href="https://rubyforge.org/tracker/index.php?func=detail&aid=6791&group_id=797&atid=3152">https://rubyforge.org/tracker/index.php?func=detail&aid=6791&group_id=797&atid=3152</A> - looks a lot like what I want.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Consider it similar to the syntax offered by mocha</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>e.g.</DIV><DIV>Order.any_instance.stubs(:shipped_on).returns(nil)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I think it would be a very helpful addition to Rspec stub/mock framework - I'd be interested in helping to implement it but I fear I don't know enough about how mocking works. I'll dig into mocha and rspec code but if any of the Rspec developers want to take the lead that would be great!</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Cheers,</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>David</DIV><BR></BODY></HTML>