Permalink
Browse files

Fixing method called on nil warning

  • Loading branch information...
1 parent 235c8cc commit 251bf2a6ecda33be486f080810ebf56af2372f61 @preethiramdev preethiramdev committed Feb 24, 2012
Showing with 7 additions and 6 deletions.
  1. +7 −6 spec/rspec/mocks/stubbed_message_expectations_spec.rb
View
13 spec/rspec/mocks/stubbed_message_expectations_spec.rb
@@ -45,11 +45,12 @@
end
it "passes when at least once method is called more than once " do
- @mock.stub(:random_call).with(1).and_return("stub")
- @mock.should_receive(:random_call).with(1).at_least(:once).and_return("expectation")
- @mock.random_call(1).should eq("expectation")
- @mock.random_call(1).should eq("expectation")
- @mock.rspec_verify
- end
+ double = double("mock")
+ double.stub(:random_call).with(1).and_return("stub")
+ double.should_receive(:random_call).with(1).at_least(:once).and_return("expectation")
+ double.random_call(1).should eq("expectation")
+ double.random_call(1).should eq("expectation")
+ double.rspec_verify
+ end
end
end

0 comments on commit 251bf2a

Please sign in to comment.