Skip to content
Browse files

stub_chain.feature

- Closes #13.
  • Loading branch information...
1 parent f0fdfca commit f5f187ea5f043ccfebfacd85e856d257379229cb @justinko justinko committed with dchelimsky Aug 26, 2010
Showing with 31 additions and 0 deletions.
  1. +31 −0 features/stubs/stub_chain.feature
View
31 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.
Something went wrong with that request. Please try again.