Reputation: 4867
Suppose, I am running this test
Class MyModelTest < ActiveSupport::TestCase
def setup do
@mymodel = MyModel.new
end
@mymodel.stub(:method).and_return { true }
but I get :undefined method 'stub' for nil:NilClass
. I thought it was related to the nil
instance, in fact when I dump with @mymodel
with data, I get the same message undefined method stub'
. Then I tried @mymodel.stubs(:method).and_return { true }
, and I got this message
undefined method `and_return'
How can I solve that ?
Upvotes: 1
Views: 478