[mocha-developer] Mocha, Stubba and RSpec

Ed Howland ed.howland at gmail.com
Wed Oct 25 12:53:11 EDT 2006


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

Is there a better way to do this?


Ed Howland

More information about the mocha-developer mailing list