[mocha-developer] Mocha, Stubba and RSpec

James Mead jamesmead44 at gmail.com
Wed Oct 25 18:12:47 EDT 2006

On 25/10/06, Ed Howland <ed.howland at gmail.com> wrote:
> I've been reading with interest the threads trying to integrate Mocha
> and Stubba with RSpec. So far, I've made the two changes in
> spec_helper.rb suggested, but discovered another one that neither of
> the archives mentions:
> If you use traditional mocking:  object = mock    or the stub shortcut
> : object = stub(:method => :result),  you run into namespace conflicts
> with RSpec which has top level names that do that as well. The actual
> error message is
> 1)  -  Stubs should work with Stubba
> undefined method `stub_space' for
> #<Spec::Runner::Specification:0xb76bd4d4>
> 2) - Mocks should work with Mocha
> ArgumentError in 'Mocks should work with Mocha'
> wrong number of arguments (0 for 1)
> I could not get alias to work (but didn't try alias_method yet,) so I
> just commented out the stub and mock calls in
> rspec-0.6.4/lib/spec/runner/execution_context.rb
> Is there a better way to do this?

Hi Ed,

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mocha-developer/attachments/20061025/2f888b1e/attachment-0001.html 

More information about the mocha-developer mailing list