rspec says: undefined method 'should_receive' for SomeClass

By: Johnathon Wright on: April 13, 2010

This took up an hour of my life today.

Here's the fix. At some point I'll go back and research "Double Ruby":http://github.com/btakita/rr to figure out what went wrong, but for now, tests are failing validly...

---diff --- a/spec/spechelper.rb +++ b/spec/spechelper.rb @@ -20,7 +20,7 @@ Spec::Runner.configure do |config| config.useinstantiatedfixtures = false config.fixturepath = RAILSROOT + '/spec/fixtures/'

  • config.mockwith :rr +# config.mockwith :rr

def setcurrentuser(user) stub(controller).current_user { user }





Comments:

Just checking that you are human. What would be the result of this code?

a = 3*(4/2); b = 1; a+b

Back