rspec-mocks 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. data/README.md +0 -19
  2. data/features/Scope.md +17 -0
  3. data/features/argument_matchers/README.md +27 -0
  4. data/features/argument_matchers/explicit.feature +60 -0
  5. data/features/argument_matchers/general_matchers.feature +85 -0
  6. data/features/argument_matchers/type_matchers.feature +25 -0
  7. data/features/message_expectations/any_instance.feature +2 -0
  8. data/features/message_expectations/receive_counts.feature +209 -0
  9. data/features/method_stubs/README.md +6 -10
  10. data/features/method_stubs/any_instance.feature +111 -1
  11. data/features/method_stubs/simple_return_value.feature +34 -25
  12. data/features/method_stubs/stub_implementation.feature +1 -1
  13. data/features/method_stubs/to_ary.feature +12 -10
  14. data/features/support/env.rb +1 -1
  15. data/lib/rspec/mocks/any_instance/chain.rb +49 -0
  16. data/lib/rspec/mocks/any_instance/expectation_chain.rb +33 -0
  17. data/lib/rspec/mocks/any_instance/message_chains.rb +48 -0
  18. data/lib/rspec/mocks/any_instance/recorder.rb +168 -0
  19. data/lib/rspec/mocks/any_instance/stub_chain.rb +35 -0
  20. data/lib/rspec/mocks/any_instance/stub_chain_chain.rb +34 -0
  21. data/lib/rspec/mocks/any_instance.rb +8 -235
  22. data/lib/rspec/mocks/argument_expectation.rb +1 -1
  23. data/lib/rspec/mocks/argument_matchers.rb +19 -25
  24. data/lib/rspec/mocks/extensions/marshal.rb +1 -1
  25. data/lib/rspec/mocks/extensions/psych.rb +1 -1
  26. data/lib/rspec/mocks/message_expectation.rb +7 -4
  27. data/lib/rspec/mocks/methods.rb +6 -8
  28. data/lib/rspec/mocks/mock.rb +2 -2
  29. data/lib/rspec/mocks/proxy.rb +4 -4
  30. data/lib/rspec/mocks/version.rb +4 -4
  31. data/lib/rspec/mocks.rb +13 -14
  32. data/spec/rspec/mocks/any_instance/message_chains_spec.rb +40 -0
  33. data/spec/rspec/mocks/any_instance_spec.rb +219 -24
  34. data/spec/rspec/mocks/any_number_of_times_spec.rb +2 -2
  35. data/spec/rspec/mocks/argument_expectation_spec.rb +15 -3
  36. data/spec/rspec/mocks/at_least_spec.rb +1 -1
  37. data/spec/rspec/mocks/at_most_spec.rb +1 -1
  38. data/spec/rspec/mocks/bug_report_10263_spec.rb +1 -1
  39. data/spec/rspec/mocks/bug_report_7611_spec.rb +1 -1
  40. data/spec/rspec/mocks/bug_report_8165_spec.rb +2 -2
  41. data/spec/rspec/mocks/bug_report_957_spec.rb +2 -2
  42. data/spec/rspec/mocks/failing_argument_matchers_spec.rb +1 -1
  43. data/spec/rspec/mocks/hash_including_matcher_spec.rb +11 -11
  44. data/spec/rspec/mocks/hash_not_including_matcher_spec.rb +6 -6
  45. data/spec/rspec/mocks/mock_spec.rb +49 -43
  46. data/spec/rspec/mocks/multiple_return_value_spec.rb +26 -26
  47. data/spec/rspec/mocks/partial_mock_spec.rb +3 -2
  48. data/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb +1 -0
  49. data/spec/rspec/mocks/passing_argument_matchers_spec.rb +3 -3
  50. data/spec/rspec/mocks/precise_counts_spec.rb +1 -1
  51. data/spec/rspec/mocks/serialization_spec.rb +7 -2
  52. data/spec/rspec/mocks/stub_implementation_spec.rb +6 -6
  53. data/spec/rspec/mocks/stub_spec.rb +6 -6
  54. data/spec/rspec/mocks/to_ary_spec.rb +9 -0
  55. metadata +45 -42
  56. data/.autotest +0 -7
  57. data/.document +0 -5
  58. data/.gitignore +0 -10
  59. data/.travis.yml +0 -7
  60. data/Gemfile +0 -40
  61. data/Guardfile +0 -8
  62. data/License.txt +0 -22
  63. data/Rakefile +0 -75
  64. data/autotest/discover.rb +0 -1
  65. data/cucumber.yml +0 -2
  66. data/features/.nav +0 -17
  67. data/features/Changelog.md +0 -80
  68. data/rspec-mocks.gemspec +0 -25
  69. data/specs.watchr +0 -57
data/README.md CHANGED
@@ -3,21 +3,6 @@
3
3
  rspec-mocks provides a test-double framework for rspec including support
4
4
  for method stubs, fakes, and message expectations.
5
5
 
6
- [![build status](http://travis-ci.org/rspec/rspec-mocks.png)](http://travis-ci.org/rspec/rspec-mocks)
7
-
8
- ## Documentation
9
-
10
- The [Cucumber features](http://relishapp.com/rspec/rspec-mocks) are the
11
- most comprehensive and up-to-date docs for end-users.
12
-
13
- The [RDoc](http://rubydoc.info/gems/rspec-mocks/2.3.0/frames) provides additional
14
- information for contributors and/or extenders.
15
-
16
- All of the documentation is open source and a work in progress. If you find it
17
- lacking or confusing, you can help improve it by submitting requests and
18
- patches to the [rspec-mocks issue
19
- tracker](https://github.com/rspec/rspec-mocks/issues).
20
-
21
6
  ## Install
22
7
 
23
8
  gem install rspec # for rspec-core, rspec-expectations, rspec-mocks
@@ -48,10 +33,6 @@ tracker](https://github.com/rspec/rspec-mocks/issues).
48
33
  end
49
34
  end
50
35
 
51
- ## Contribute
52
-
53
- See [http://github.com/rspec/rspec-dev](http://github.com/rspec/rspec-dev)
54
-
55
36
  ## Also see
56
37
 
57
38
  * [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
data/features/Scope.md ADDED
@@ -0,0 +1,17 @@
1
+ Doubles, stubs, and message expectations are all cleaned out after each
2
+ example. This ensures that each example can be run in isolation, and in any
3
+ order.
4
+
5
+ ### `before(:each)`
6
+
7
+ It is perfectly fine to set up doubles, stubs, and message expectations in
8
+ a `before(:each)` hook, as that hook is executed in the scope of the example:
9
+
10
+ before(:each) do
11
+ @account = double('account')
12
+ end
13
+
14
+ ### Do not create doubles, stubs, or message expectations in `before(:all)`
15
+
16
+ If you do, they'll get cleaned out after the first example, and you will be
17
+ very confused as to what's going on in the second example.
@@ -0,0 +1,27 @@
1
+ ### Introduction
2
+
3
+ Argument matchers can be used:
4
+
5
+ * In stubs to constrain the scope of the stubbed method
6
+
7
+ obj.stub(:foo).with(:bar) do |arg|
8
+ #do something for :bar
9
+ end
10
+ obj.stub(:foo).with(:baz) do |arg|
11
+ #do something for :baz
12
+ end
13
+
14
+ * In expectations to validate the arguments that should be received in a method call
15
+
16
+ #create a double
17
+ obj = double()
18
+
19
+ #expect a message with given args
20
+ obj.should_receive(:message).with('an argument')
21
+
22
+ If more control is needed, one can use a block
23
+
24
+ obj.should_receive(:message) do |arg1, arg2|
25
+ # set expectations about the args in this block
26
+ # and optionally set a return value
27
+ end
@@ -0,0 +1,60 @@
1
+ Feature: explicit arguments
2
+
3
+ Allows you to explicitly specify the argument values
4
+
5
+ Scenario: explicit arguments
6
+ Given a file named "stub_explicit_args_spec.rb" with:
7
+ """
8
+ describe "stubbed explicit arguments" do
9
+ it "works on stubs" do
10
+ object = Object.new
11
+ object.stub(:foo).with(:this) do |arg|
12
+ "got this"
13
+ end
14
+ object.stub(:foo).with(:that) do |arg|
15
+ "got that"
16
+ end
17
+
18
+ object.foo(:this).should eq("got this")
19
+ object.foo(:that).should eq("got that")
20
+ end
21
+
22
+ it "works on doubles and expectations" do
23
+ object = double('foo')
24
+ object.should_receive(:bar).with(:foo)
25
+
26
+ object.bar(:foo)
27
+ end
28
+ end
29
+ """
30
+ When I run `rspec stub_explicit_args_spec.rb`
31
+ Then the output should contain "2 examples, 0 failures"
32
+
33
+ Scenario: explicit arguments with multiple arities
34
+ Given a file named "stub_multiple_explicit_args_spec.rb" with:
35
+ """
36
+ describe "stubbed multiple explicit arguments" do
37
+ it "works on stubs" do
38
+ object = Object.new
39
+ object.stub(:foo).with(:this) do |arg|
40
+ "got this"
41
+ end
42
+ object.stub(:foo).with(:this, :that) do |arg1, arg2|
43
+ "got this and that"
44
+ end
45
+
46
+ object.foo(:this).should eq("got this")
47
+ object.foo(:this, :that).should eq("got this and that")
48
+ end
49
+
50
+ it "works on mocks" do
51
+ object = double('foo')
52
+ object.should_receive(:foo).with(:this, :that)
53
+
54
+ object.foo(:this, :that)
55
+ end
56
+ end
57
+ """
58
+ When I run `rspec stub_multiple_explicit_args_spec.rb`
59
+ Then the output should contain "2 examples, 0 failures"
60
+
@@ -0,0 +1,85 @@
1
+ Feature: General matchers
2
+
3
+ The `anything`, `any_args`, and `no_args` matchers can be used to require the method
4
+ to have arguments (or not) without constraining the details of the argument, such as its
5
+ type, pattern or value. The `anything` matcher only reflects a single argument, while
6
+ the `any_args` matcher matches any arity.
7
+
8
+ Scenario: anything argument matcher
9
+ Given a file named "stub_anything_args_spec.rb" with:
10
+ """
11
+ describe "stubbed anything() args spec" do
12
+ it "works" do
13
+ object = Object.new
14
+ object.stub(:foo).with(anything) do
15
+ "anything"
16
+ end
17
+
18
+ object.foo(1).should eq("anything")
19
+ object.foo(:that).should eq("anything")
20
+ end
21
+ end
22
+ """
23
+ When I run `rspec stub_anything_args_spec.rb`
24
+ Then the output should contain "1 example, 0 failures"
25
+
26
+ Scenario: any_args argument matcher
27
+ Given a file named "stub_any_args_spec.rb" with:
28
+ """
29
+ describe "stubbed any_args() args spec" do
30
+ it "works" do
31
+ object = Object.new
32
+ object.stub(:foo).with(any_args) do
33
+ "anything"
34
+ end
35
+
36
+ object.foo(1).should eq("anything")
37
+ object.foo(:that).should eq("anything")
38
+ object.foo.should eq("anything")
39
+ end
40
+ end
41
+ """
42
+ When I run `rspec stub_any_args_spec.rb`
43
+ Then the output should contain "1 example, 0 failures"
44
+
45
+ Scenario: no_args argument matcher
46
+ Given a file named "stub_no_args_spec.rb" with:
47
+ """
48
+ describe "stubbed no_args() args spec" do
49
+ it "works for no args" do
50
+ object = Object.new
51
+ object.stub(:foo).with(no_args) do
52
+ "nothing"
53
+ end
54
+ object.stub(:foo).with(anything) do
55
+ "something"
56
+ end
57
+
58
+ object.foo(:that).should eq("something")
59
+ object.foo.should eq("nothing")
60
+ end
61
+ end
62
+ """
63
+ When I run `rspec stub_no_args_spec.rb`
64
+ Then the output should contain "1 example, 0 failures"
65
+
66
+ Scenario: no_args argument matcher for expectations
67
+ Given a file named "stub_no_args_expectations_spec.rb" with:
68
+ """
69
+ describe "stubbed no_args() args spec for expectations" do
70
+ it "works for no args" do
71
+ object = Object.new
72
+ object.should_receive(:foo).with(no_args)
73
+
74
+ object.foo
75
+ end
76
+ it "fails for args" do
77
+ object = Object.new
78
+ object.should_receive(:foo).with(no_args)
79
+
80
+ object.foo(:bar)
81
+ end
82
+ end
83
+ """
84
+ When I run `rspec stub_no_args_expectations_spec.rb`
85
+ Then the output should contain "2 examples, 1 failure"
@@ -0,0 +1,25 @@
1
+ Feature: stub with argument constraints
2
+
3
+ You can further specify the behavior by constraining the type, format and/or number of arguments with the #with() method chained off of #stub()
4
+
5
+ Scenario: an_instance_of argument matcher
6
+ Given a file named "stub_an_instance_of_args_spec.rb" with:
7
+ """
8
+ describe "stubbed an_instance_of() args spec" do
9
+ it "works" do
10
+ object = Object.new
11
+ object.stub(:foo).with(an_instance_of(Symbol)) do
12
+ "symbol"
13
+ end
14
+ object.stub(:foo).with(an_instance_of(String)) do
15
+ "string"
16
+ end
17
+
18
+ object.foo("bar").should eq("string")
19
+ object.foo(:that).should eq("symbol")
20
+ end
21
+ end
22
+ """
23
+ When I run `rspec stub_an_instance_of_args_spec.rb`
24
+ Then the output should contain "1 example, 0 failures"
25
+
@@ -2,6 +2,8 @@ Feature: expect a message on any instance of a class
2
2
 
3
3
  Use `any_instance.should_receive` to set an expectation that one (and only
4
4
  one) instance of a class receives a message before the example is completed.
5
+
6
+ The spec will fail if no instance receives a message.
5
7
 
6
8
  Scenario: expect a message on any instance of a class
7
9
  Given a file named "example_spec.rb" with:
@@ -0,0 +1,209 @@
1
+ Feature: receive counts
2
+
3
+ Scenario: expect a message once
4
+ Given a file named "spec/account_spec.rb" with:
5
+ """
6
+ class Account
7
+ attr_accessor :logger
8
+
9
+ def open
10
+ logger.account_opened
11
+ end
12
+ end
13
+
14
+ describe Account do
15
+ context "when opened" do
16
+ it "logger#account_opened was called once" do
17
+ logger = double("logger")
18
+ account = Account.new
19
+ account.logger = logger
20
+
21
+ logger.should_receive(:account_opened).once
22
+
23
+ account.open
24
+ end
25
+ end
26
+ end
27
+ """
28
+ When I run `rspec spec/account_spec.rb`
29
+ Then the output should contain "1 example, 0 failures"
30
+
31
+ Scenario: expect a message twice
32
+ Given a file named "spec/account_spec.rb" with:
33
+ """
34
+ class Account
35
+ attr_accessor :logger
36
+
37
+ def open
38
+ logger.account_opened
39
+ end
40
+ end
41
+
42
+ describe Account do
43
+ context "when opened" do
44
+ it "logger#account_opened was called once" do
45
+ logger = double("logger")
46
+ account = Account.new
47
+ account.logger = logger
48
+
49
+ logger.should_receive(:account_opened).twice
50
+
51
+ account.open
52
+ account.open
53
+ end
54
+ end
55
+ end
56
+ """
57
+ When I run `rspec spec/account_spec.rb`
58
+ Then the output should contain "1 example, 0 failures"
59
+
60
+ Scenario: expect a message 3 times
61
+ Given a file named "spec/account_spec.rb" with:
62
+ """
63
+ class Account
64
+ attr_accessor :logger
65
+
66
+ def open
67
+ logger.account_opened
68
+ end
69
+ end
70
+
71
+ describe Account do
72
+ context "when opened" do
73
+ it "logger#account_opened was called once" do
74
+ logger = double("logger")
75
+ account = Account.new
76
+ account.logger = logger
77
+
78
+ logger.should_receive(:account_opened).exactly(3).times
79
+
80
+ account.open
81
+ account.open
82
+ account.open
83
+ end
84
+ end
85
+ end
86
+ """
87
+ When I run `rspec spec/account_spec.rb`
88
+ Then the output should contain "1 example, 0 failures"
89
+
90
+ Scenario: expect a message at least (:once)
91
+ Given a file named "spec/account_spec.rb" with:
92
+ """
93
+ class Account
94
+ attr_accessor :logger
95
+
96
+ def open
97
+ logger.account_opened
98
+ end
99
+ end
100
+
101
+ describe Account do
102
+ context "when opened" do
103
+ it "logger#account_opened was called once" do
104
+ logger = double("logger")
105
+ account = Account.new
106
+ account.logger = logger
107
+
108
+ logger.should_receive(:account_opened).at_least(:once)
109
+
110
+ account.open
111
+ end
112
+ end
113
+ end
114
+ """
115
+ When I run `rspec spec/account_spec.rb`
116
+ Then the output should contain "1 example, 0 failures"
117
+
118
+
119
+ Scenario: expect a message at least (n) times
120
+ Given a file named "spec/account_spec.rb" with:
121
+ """
122
+ class Account
123
+ attr_accessor :logger
124
+
125
+ def open
126
+ logger.account_opened
127
+ end
128
+ end
129
+
130
+ describe Account do
131
+ context "when opened" do
132
+ it "logger#account_opened was called once" do
133
+ logger = double("logger")
134
+ account = Account.new
135
+ account.logger = logger
136
+
137
+ logger.should_receive(:account_opened).at_least(3).times
138
+
139
+ # Note that I am calling method under test 4 times
140
+ # and I specified it to be called at least 3 times
141
+ account.open
142
+ account.open
143
+ account.open
144
+ account.open
145
+ end
146
+ end
147
+ end
148
+ """
149
+ When I run `rspec spec/account_spec.rb`
150
+ Then the output should contain "1 example, 0 failures"
151
+
152
+ Scenario: expect a message at most (:once)
153
+ Given a file named "spec/account_spec.rb" with:
154
+ """
155
+ class Account
156
+ attr_accessor :logger
157
+
158
+ def open
159
+ logger.account_opened
160
+ end
161
+ end
162
+
163
+ describe Account do
164
+ context "when opened" do
165
+ it "logger#account_opened was called once" do
166
+ logger = double("logger")
167
+ account = Account.new
168
+ account.logger = logger
169
+
170
+ logger.should_receive(:account_opened).at_most(:once)
171
+
172
+ account.open
173
+ account.open
174
+ end
175
+ end
176
+ end
177
+ """
178
+ When I run `rspec spec/account_spec.rb`
179
+ Then the output should contain "expected: 1 time"
180
+ And the output should contain "received: 2 times"
181
+
182
+ Scenario: expect a message at most (n) times
183
+ Given a file named "spec/account_spec.rb" with:
184
+ """
185
+ class Account
186
+ attr_accessor :logger
187
+
188
+ def open
189
+ logger.account_opened
190
+ end
191
+ end
192
+
193
+ describe Account do
194
+ context "when opened" do
195
+ it "logger#account_opened was called once" do
196
+ logger = double("logger")
197
+ account = Account.new
198
+ account.logger = logger
199
+
200
+ logger.should_receive(:account_opened).at_most(2).times
201
+
202
+ account.open
203
+ account.open
204
+ end
205
+ end
206
+ end
207
+ """
208
+ When I run `rspec spec/account_spec.rb`
209
+ Then the output should contain "1 example, 0 failures"
@@ -1,15 +1,12 @@
1
1
  ### Stub return values
2
2
 
3
- obj.stub(:message).and_return('this is the value to return')
4
- obj.stub(:message) { 'this is the value to return' }
3
+ obj.stub(:message) { :value }
4
+ obj.stub(:message => :value)
5
+ obj.stub(:message).and_return(:value)
5
6
 
6
- These two forms are somewhat interchangeable. The difference is that the
7
- argument to `and_return` is evaluated immediately, whereas the block contents
8
- are evaluated lazily when the `obj` receives the `message` message.
9
-
10
- The block format is generally preferred as it is more terse and more consistent
11
- with other forms described below, but lazy evaluation can be confusing because
12
- things aren't evaluated in the order in which they are declared.
7
+ These forms are somewhat interchangeable. The difference is that the block
8
+ contents are evaluated lazily when the `obj` receives the `message` message,
9
+ whereas the others are evaluated as they are read.
13
10
 
14
11
  ### Fake implementation
15
12
 
@@ -44,4 +41,3 @@ You can also use the block format, for consistency with other stubs:
44
41
  #### Regular expressions
45
42
 
46
43
  obj.stub(:message).with(/abc/) { ... }
47
-
@@ -6,7 +6,7 @@ Feature: stub on any instance of a class
6
6
 
7
7
  Messages can be stubbed on any class, including those in Ruby's core library.
8
8
 
9
- Scenario: simple any_instance stub with a single return value
9
+ Scenario: any_instance stub with a single return value
10
10
  Given a file named "example_spec.rb" with:
11
11
  """
12
12
  describe "any_instance.stub" do
@@ -20,4 +20,114 @@ Feature: stub on any instance of a class
20
20
  """
21
21
  When I run `rspec example_spec.rb`
22
22
  Then the examples should all pass
23
+
24
+ Scenario: any_instance stub with a hash
25
+ Given a file named "example_spec.rb" with:
26
+ """
27
+ describe "any_instance.stub" do
28
+ context "with a hash" do
29
+ it "returns the hash values on any instance of the class" do
30
+ Object.any_instance.stub(:foo => 'foo', :bar => 'bar')
31
+
32
+ o = Object.new
33
+ o.foo.should eq('foo')
34
+ o.bar.should eq('bar')
35
+ end
36
+ end
37
+ end
38
+ """
39
+ When I run `rspec example_spec.rb`
40
+ Then the examples should all pass
41
+
42
+ Scenario: any_instance stub with specific arguments matchers
43
+ Given a file named "example_spec.rb" with:
44
+ """
45
+ describe "any_instance.stub" do
46
+ context "with arguments" do
47
+ it "returns the stubbed value when arguments match" do
48
+ Object.any_instance.stub(:foo).with(:param_one, :param_two).and_return(:result_one)
49
+ Object.any_instance.stub(:foo).with(:param_three, :param_four).and_return(:result_two)
50
+
51
+ o = Object.new
52
+ o.foo(:param_one, :param_two).should eq(:result_one)
53
+ o.foo(:param_three, :param_four).should eq(:result_two)
54
+ end
55
+ end
56
+ end
57
+ """
58
+ When I run `rspec example_spec.rb`
59
+ Then the examples should all pass
60
+
61
+ Scenario: any_instance unstub
62
+ Given a file named "example_spec.rb" with:
63
+ """
64
+ describe "any_instance.unstub" do
65
+ it "unstubs a stubbed method" do
66
+ class Object
67
+ def foo
68
+ :foo
69
+ end
70
+ end
71
+
72
+ Object.any_instance.stub(:foo)
73
+ Object.any_instance.unstub(:foo)
74
+
75
+ Object.new.foo.should eq(:foo)
76
+ end
77
+ end
78
+ """
79
+ When I run `rspec example_spec.rb`
80
+ Then the examples should all pass
81
+
82
+ Scenario: any_instance unstub
83
+ Given a file named "example_spec.rb" with:
84
+ """
85
+ describe "any_instance.unstub" do
86
+ context "with both an expectation and a stub already set" do
87
+ it "only removes the stub" do
88
+ class Object
89
+ def foo
90
+ :foo
91
+ end
92
+ end
93
+ Object.any_instance.should_receive(:foo).and_return(:bar)
94
+ Object.any_instance.stub(:foo)
95
+ Object.any_instance.unstub(:foo)
96
+
97
+ Object.new.foo.should eq(:bar)
98
+ end
99
+ end
100
+ end
101
+ """
102
+ When I run `rspec example_spec.rb`
103
+ Then the examples should all pass
104
+
105
+ Scenario: stub a chain of methods an any instance
106
+ Given a file named "stub_chain_spec.rb" with:
107
+ """
108
+ describe "stubbing a chain of methods" do
109
+ context "given symbols representing methods" do
110
+ it "returns the correct value" do
111
+ Object.any_instance.stub_chain(:one, :two, :three).and_return(:four)
112
+ Object.new.one.two.three.should eq(:four)
113
+ end
114
+ end
115
+
116
+ context "given a hash at the end" do
117
+ it "returns the correct value" do
118
+ Object.any_instance.stub_chain(:one, :two, :three => :four)
119
+ Object.new.one.two.three.should eq(:four)
120
+ end
121
+ end
23
122
 
123
+ context "given a string of methods separated by dots" do
124
+ it "returns the correct value" do
125
+ Object.any_instance.stub_chain("one.two.three").and_return(:four)
126
+ Object.new.one.two.three.should eq(:four)
127
+ end
128
+ end
129
+ end
130
+ """
131
+ When I run `rspec stub_chain_spec.rb`
132
+ Then the examples should all pass
133
+