Skip to content

Commit

Permalink
Add a spec which demonstrates how args work with stub chain
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Phippen committed Dec 30, 2013
1 parent 88984d5 commit 6e734ac
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec/rspec/mocks/stub_chain_spec.rb
Expand Up @@ -29,6 +29,13 @@ module Mocks
end

context "with two methods in chain" do
it "accepts any number of arguments to the stubbed messages in the chain" do
object.stub_chain(:msg1, :msg2).and_return(:return_value)
expect {
object.msg1("nonsense", :value).msg2("another", :nonsense, 3.0, "value")
}.not_to raise_error
end

context "using and_return" do
it "returns expected value from chaining two method calls" do
object.stub_chain(:msg1, :msg2).and_return(:return_value)
Expand Down

0 comments on commit 6e734ac

Please sign in to comment.