On 25/10/06, <b class="gmail_sendername">Ed Howland</b> <<a href="mailto:ed.howland@gmail.com">ed.howland@gmail.com</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've been reading with interest the threads trying to integrate Mocha<br>and Stubba with RSpec. So far, I've made the two changes in<br>spec_helper.rb suggested, but discovered another one that neither of<br>the archives mentions:
<br><br>If you use traditional mocking: object = mock or the stub shortcut<br>: object = stub(:method => :result), you run into namespace conflicts<br>with RSpec which has top level names that do that as well. The actual
<br>error message is<br><br>1) - Stubs should work with Stubba<br>undefined method `stub_space' for #<Spec::Runner::Specification:0xb76bd4d4><br><br>2) - Mocks should work with Mocha<br>ArgumentError in 'Mocks should work with Mocha'
<br>wrong number of arguments (0 for 1)<br><br>I could not get alias to work (but didn't try alias_method yet,) so I<br>just commented out the stub and mock calls in<br>rspec-0.6.4/lib/spec/runner/execution_context.rb<br>
<br>Is there a better way to do this?<br></blockquote></div><br>Hi Ed,<br><br>Unfortunately I haven't had much time to work on Mocha recently. The work I have done most recently has been to make Mocha useable in the absence of Test::Unit. This should help with integrating with the more recent incarnations of RSpec. Take a look at the standalone_acceptance_test.rb file in HEAD (revision 70) for some ideas on how to hook into Mocha from a non Test::Unit testing framework. This is still a bit of a work in progress, but you might be able to get somewhere with it.
<br clear="all"><br>-- <br>James.<br><a href="http://blog.floehopper.org">http://blog.floehopper.org</a>