Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined method `rspec_reset' with rspec version 2.14

I am trying execute test cases with rspec version 2.14 for which I am getting following error

undefined method `rspec_reset' for

I am trying to use rspec_reset on the class. The same test cases are working with rspec 2.13.1. So is it possible that rspec_reset method is not available after 2.13?

like image 638
kunal Avatar asked Aug 14 '13 11:08

kunal


1 Answers

The reset method does not exist in RSpec 2.14.x. Instead, it is a helper method defined inside the spec_helper.rb file for the rspec-mocks project.

module VerifyAndResetHelpers
  def verify(object)
    RSpec::Mocks.proxy_for(object).verify
  end

  def reset(object)
    RSpec::Mocks.proxy_for(object).reset
  end
end

You can see that this method delegates the reset action to the underlying proxy instead of tacking it on to the class definition of the object in question.

like image 71
Bernhard Köhler Avatar answered Sep 18 '22 20:09

Bernhard Köhler