Skip to content
Browse files

Add example for return value of expectation set on stubbed method wit…

…h args [#1009]
  • Loading branch information...
1 parent 56e56c6 commit 15a26285a1f9e8fdbbc17590ece425af02d2e112 @tomstuart tomstuart committed with Jun 14, 2010
Showing with 7 additions and 0 deletions.
  1. +7 −0 spec/spec/mocks/mock_spec.rb
View
7 spec/spec/mocks/mock_spec.rb
@@ -464,6 +464,13 @@ module Mocks
@mock.rspec_verify
end
+ it "should return the stubbed value when stubbed with args and no new value specified" do
+ @mock.stub!(:msg).with(:arg).and_return(:stub_value)
+ @mock.should_receive(:msg).with(:arg)
+ @mock.msg(:arg).should equal(:stub_value)
+ @mock.rspec_verify
+ end
+
it "should not mess with the stub's yielded values when also mocked" do
@mock.stub!(:yield_back).and_yield(:stub_value)
@mock.should_receive(:yield_back).and_yield(:mock_value)

0 comments on commit 15a2628

Please sign in to comment.
Something went wrong with that request. Please try again.