On 22/11/06, <b class="gmail_sendername">Jason Watkins</b> <<a href="mailto:jason@jasonwatkins.net">jason@jasonwatkins.net</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> I think the objections are more practical than philosophical. If you are new<br><br>Right. I wasn't interested in this particular debate.</blockquote><div><br>I'm sorry I appear to have touched a nerve. I was merely trying to pass on advice that I have found useful in my own work.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">> Some of these hooks are not considered parts of the published API and so are
<br>> subject to change.<br><br>Right. I've gotten this far on my own. My bringing it up is to </blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
suggest that perhaps it should be part of the API.</blockquote><div><br>As I tried to explain, I think one of the main problems in doing this is finding somewhere to call the hooks I mentioned in my last email. If you take the view that you only want to use stubs and have no requirement for verifying expectations, you still need to decide when to create the
<span style="font-family: courier new,monospace;">$stubba</span> global variable and when to revert the stubbed objects/classes to their original state. Do you have some constructive ideas on this front?<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If you feel "you shouldn't do that, so I'm not going to help you do<br>it", then another justification would be so that mocha isn't wired so<br>directly to Test::Unit.</blockquote><div><br>I think you're being harsh when you say that "I'm not going to help you" when I gave you the four point explanation below. You should also note that the HEAD version of Mocha already has a Standalone module which is not wired directly to Test::Unit, to allow simple integration with other testing frameworks.
<br><blockquote>There is nothing to stop you using Mocha in your development environment, but there are a few issues you should think about...<br><br> 1) No convenience methods for creating mocks or stubs - you would have to directly instantiate them using something like
<span style="font-family: courier new,monospace;">Mocha::Mock.new</span><br><br> 2) <span style="font-family: courier new,monospace;">$stubba</span> global variable is not defined - you would have to do something like
<span style="font-family: courier new,monospace;">$stubba = Mocha::Central.new</span><br><br> 3) No auto-verification of expectations - you would have to explicitly call the <span style="font-family: courier new,monospace;">
verify</span> method on traditional mock/stub objects and <span style="font-family: courier new,monospace;">$stubba.verify_all</span> to verify expectations on real objects<br><br> 4) Probably most importantly, no rolling back of stubbing - you would have to explicitly rollback by calling
<span style="font-family: courier new,monospace;">$stubba.unstub_all</span><br><br></blockquote></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Another example would be exploratory programing.</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">It looks like I'll just write my own.
</blockquote><div><br> Good luck.<br></div></div><br>-- <br>James.<br><a href="http://blog.floehopper.org">http://blog.floehopper.org</a>