not_a_mock icon indicating copy to clipboard operation
not_a_mock copied to clipboard

Not compatible with rspec 2.x

Open yob opened this issue 13 years ago • 0 comments

This is actually an rspec 2 issue, but I'm recording it here for others reference.

The config.mock_with method in rspec 2 takes a symbol or string instead of a module and has a hard coded list of acceptable mocking frameworks, so passing the NotAMock adaptor does nothing.

This prevents stubs and mocks from being reset after each example.

The work around until (if?) rspec allows arbitrary mocking frameworks again is to add the following code to spec_helper.rb

config.before(:each) do
  NotAMock::CallRecorder.instance.reset
  NotAMock::Stubber.instance.reset
end

yob avatar Dec 04 '10 08:12 yob