Skip to content

Commit

Permalink
stub_chain.feature
Browse files Browse the repository at this point in the history
- Closes rspec#13.
  • Loading branch information
justinko authored and dchelimsky committed Aug 31, 2010
1 parent f0fdfca commit f5f187e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions features/stubs/stub_chain.feature
@@ -0,0 +1,31 @@
Feature: stub_chain

Scenario: stub a chain of methods
Given a file named "stub_chain_spec.rb" with:
"""
describe "stubbing a chain of methods" do
subject { Object.new }
context "given symbols as methods" do
it "returns the correct value" do
subject.stub_chain(:one, :two, :three).and_return(:four)
subject.one.two.three.should eql(:four)
end
end
context "given a string of methods separated by dots" do
it "returns the correct value" do
subject.stub_chain("one.two.three").and_return(:four)
subject.one.two.three.should eql(:four)
end
end
end
"""
When I run "rspec stub_chain_spec.rb"
Then the output should contain "2 examples, 0 failures"

0 comments on commit f5f187e

Please sign in to comment.