rspec-mocks 2.13.1 → 2.14.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/Changelog.md +45 -4
  2. data/README.md +1 -1
  3. data/features/argument_matchers/README.md +2 -2
  4. data/features/argument_matchers/explicit.feature +2 -3
  5. data/features/argument_matchers/general_matchers.feature +2 -2
  6. data/features/argument_matchers/type_matchers.feature +3 -4
  7. data/features/message_expectations/README.md +2 -2
  8. data/features/message_expectations/any_instance.feature +2 -2
  9. data/features/message_expectations/block_local_expectations.feature.pending +3 -3
  10. data/features/message_expectations/expect_message_using_expect.feature +103 -0
  11. data/features/message_expectations/expect_message_using_should_receive.feature +118 -0
  12. data/features/message_expectations/receive_counts.feature +1 -1
  13. data/features/method_stubs/README.md +1 -1
  14. data/features/method_stubs/any_instance.feature +11 -11
  15. data/features/method_stubs/as_null_object.feature +1 -1
  16. data/features/method_stubs/stub_implementation.feature +2 -2
  17. data/features/outside_rspec/configuration.feature +0 -20
  18. data/features/spies/spy_partial_mock_method.feature +34 -0
  19. data/features/spies/spy_pure_mock_method.feature +76 -0
  20. data/features/spies/spy_unstubbed_method.feature +18 -0
  21. data/features/step_definitions/additional_cli_steps.rb +7 -0
  22. data/features/test_frameworks/test_unit.feature +43 -0
  23. data/lib/rspec/mocks.rb +9 -34
  24. data/lib/rspec/mocks/any_instance/chain.rb +8 -2
  25. data/lib/rspec/mocks/any_instance/expectation_chain.rb +19 -16
  26. data/lib/rspec/mocks/any_instance/recorder.rb +6 -3
  27. data/lib/rspec/mocks/any_instance/stub_chain.rb +11 -11
  28. data/lib/rspec/mocks/any_instance/stub_chain_chain.rb +8 -10
  29. data/lib/rspec/mocks/argument_list_matcher.rb +7 -3
  30. data/lib/rspec/mocks/configuration.rb +28 -1
  31. data/lib/rspec/mocks/deprecation.rb +18 -0
  32. data/lib/rspec/mocks/error_generator.rb +60 -8
  33. data/lib/rspec/mocks/errors.rb +1 -1
  34. data/lib/rspec/mocks/example_methods.rb +39 -3
  35. data/lib/rspec/mocks/extensions/marshal.rb +4 -10
  36. data/lib/rspec/mocks/framework.rb +16 -4
  37. data/lib/rspec/mocks/instance_method_stasher.rb +3 -0
  38. data/lib/rspec/mocks/matchers/have_received.rb +93 -0
  39. data/lib/rspec/mocks/matchers/receive.rb +92 -0
  40. data/lib/rspec/mocks/message_expectation.rb +66 -129
  41. data/lib/rspec/mocks/method_double.rb +50 -43
  42. data/lib/rspec/mocks/mutate_const.rb +8 -20
  43. data/lib/rspec/mocks/proxy.rb +41 -25
  44. data/lib/rspec/mocks/proxy_for_nil.rb +36 -0
  45. data/lib/rspec/mocks/space.rb +64 -11
  46. data/lib/rspec/mocks/stub_chain.rb +51 -0
  47. data/lib/rspec/mocks/syntax.rb +329 -0
  48. data/lib/rspec/mocks/targets.rb +69 -0
  49. data/lib/rspec/mocks/test_double.rb +25 -4
  50. data/lib/rspec/mocks/version.rb +1 -1
  51. data/lib/spec/mocks.rb +1 -3
  52. data/spec/rspec/mocks/and_call_original_spec.rb +8 -0
  53. data/spec/rspec/mocks/and_yield_spec.rb +6 -6
  54. data/spec/rspec/mocks/any_instance_spec.rb +43 -31
  55. data/spec/rspec/mocks/any_number_of_times_spec.rb +6 -0
  56. data/spec/rspec/mocks/argument_expectation_spec.rb +12 -14
  57. data/spec/rspec/mocks/at_least_spec.rb +46 -37
  58. data/spec/rspec/mocks/at_most_spec.rb +12 -12
  59. data/spec/rspec/mocks/block_return_value_spec.rb +18 -1
  60. data/spec/rspec/mocks/bug_report_10260_spec.rb +1 -1
  61. data/spec/rspec/mocks/bug_report_10263_spec.rb +1 -1
  62. data/spec/rspec/mocks/bug_report_11545_spec.rb +4 -4
  63. data/spec/rspec/mocks/bug_report_600_spec.rb +1 -1
  64. data/spec/rspec/mocks/bug_report_7611_spec.rb +1 -1
  65. data/spec/rspec/mocks/configuration_spec.rb +124 -0
  66. data/spec/rspec/mocks/double_spec.rb +13 -1
  67. data/spec/rspec/mocks/failing_argument_matchers_spec.rb +17 -1
  68. data/spec/rspec/mocks/hash_excluding_matcher_spec.rb +13 -13
  69. data/spec/rspec/mocks/matchers/have_received_spec.rb +266 -0
  70. data/spec/rspec/mocks/matchers/receive_spec.rb +318 -0
  71. data/spec/rspec/mocks/methods_spec.rb +27 -0
  72. data/spec/rspec/mocks/mock_ordering_spec.rb +4 -4
  73. data/spec/rspec/mocks/mock_space_spec.rb +94 -39
  74. data/spec/rspec/mocks/mock_spec.rb +65 -50
  75. data/spec/rspec/mocks/multiple_return_value_spec.rb +10 -10
  76. data/spec/rspec/mocks/mutate_const_spec.rb +21 -1
  77. data/spec/rspec/mocks/nil_expectation_warning_spec.rb +10 -4
  78. data/spec/rspec/mocks/null_object_mock_spec.rb +11 -2
  79. data/spec/rspec/mocks/once_counts_spec.rb +5 -5
  80. data/spec/rspec/mocks/options_hash_spec.rb +4 -4
  81. data/spec/rspec/mocks/partial_mock_spec.rb +20 -11
  82. data/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb +7 -7
  83. data/spec/rspec/mocks/passing_argument_matchers_spec.rb +2 -2
  84. data/spec/rspec/mocks/precise_counts_spec.rb +6 -6
  85. data/spec/rspec/mocks/serialization_spec.rb +1 -22
  86. data/spec/rspec/mocks/stash_spec.rb +4 -12
  87. data/spec/rspec/mocks/stub_implementation_spec.rb +3 -3
  88. data/spec/rspec/mocks/stub_spec.rb +44 -20
  89. data/spec/rspec/mocks/stubbed_message_expectations_spec.rb +6 -6
  90. data/spec/rspec/mocks/twice_counts_spec.rb +6 -6
  91. data/spec/rspec/mocks_spec.rb +1 -3
  92. data/spec/spec_helper.rb +25 -1
  93. metadata +86 -81
  94. data/features/message_expectations/expect_message.feature +0 -94
  95. data/lib/rspec/mocks/any_instance.rb +0 -81
  96. data/lib/rspec/mocks/extensions/psych.rb +0 -23
  97. data/lib/rspec/mocks/methods.rb +0 -155
  98. data/lib/rspec/mocks/serialization.rb +0 -34
  99. data/spec/rspec/mocks/combining_implementation_instructions_spec.rb +0 -197
@@ -1,10 +1,51 @@
1
- ### 2.13.1 / 2013-04-06
2
- [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.13.0...v2.13.1)
1
+ ### 2.14.0.rc1 / 2013-05-27
2
+ [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.13.0...v2.14.0.rc1)
3
+
4
+ Enhancements:
5
+
6
+ * Refactor internals so that the mock proxy methods and state are held
7
+ outside of the mocked object rather than inside it. This paves the way
8
+ for future syntax enhancements and removes the need for some hacky
9
+ work arounds for `any_instance` dup'ing and `YAML` serialization,
10
+ among other things. Note that the code now relies upon `__id__`
11
+ returning a unique, consistent value for any object you want to
12
+ mock or stub (Myron Marston).
13
+ * Add support for test spies. This allows you to verify a message
14
+ was received afterwards using the `have_received` matcher.
15
+ Note that you must first stub the method or use a null double.
16
+ (Joe Ferris and Joël Quenneville)
17
+ * Make `at_least` and `at_most` style receive expectations print that they were
18
+ expecting at least or at most some number of calls, rather than just the
19
+ number of calls given in the expectation (Sam Phippen)
20
+ * Make `with` style receive expectations print the args they were expecting, and
21
+ the args that they got (Sam Phippen)
22
+ * Fix some warnings seen under ruby 2.0.0p0 (Sam Phippen).
23
+ * Add a new `:expect` syntax for message expectations
24
+ (Myron Marston and Sam Phippen).
3
25
 
4
26
  Bug fixes
5
27
 
6
- * Allow a block implementation to be used in combination with
7
- `and_yield`, `and_raise`, `and_return` or `and_throw` (Myron Marston).
28
+ * Fix `any_instance` so that a frozen object can be `dup`'d when methods
29
+ have been stubbed on that type using `any_instance` (Jon Rowe).
30
+ * Fix `and_call_original` so that it properly raises an `ArgumentError`
31
+ when the wrong number of args are passed (Jon Rowe).
32
+ * Fix `double` on 1.9.2 so you can wrap them in an Array
33
+ using `Array(my_double)` (Jon Rowe).
34
+ * Fix `stub_const` and `hide_const` to handle constants that redefine `send`
35
+ (Sam Phippen).
36
+ * Fix `Marshal.dump` extension so that it correctly handles nil.
37
+ (Luke Imhoff, Jon Rowe)
38
+ * Fix isolation of `allow_message_expectations_on_nil` (Jon Rowe)
39
+ * Use inspect to format actual arguments on expectations in failure messages (#280, Ben Langfeld)
40
+
41
+ Deprecations
42
+
43
+ * Deprecate `stub` and `mock` as aliases for `double`. `double` is the
44
+ best term for creating a test double, and it reduces confusion to
45
+ have only one term (Michi Huber).
46
+ * Deprecate `stub!` and `unstub!` in favor of `stub` and `unstub`
47
+ (Jon Rowe).
48
+ * Deprecate `at_least(0).times` and `any_number_of_times` (Michi Huber).
8
49
 
9
50
  ### 2.13.0 / 2013-02-23
10
51
  [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.12.2...v2.13.0)
data/README.md CHANGED
@@ -50,7 +50,7 @@ This is particularly nice when providing a list of test doubles to a method
50
50
  that iterates through them:
51
51
 
52
52
  ```ruby
53
- order.calculate_total_price(stub(:price => 1.99),stub(:price => 2.99))
53
+ order.calculate_total_price(double(:price => 1.99),double(:price => 2.99))
54
54
  ```
55
55
 
56
56
  ## Consecutive return values
@@ -15,7 +15,7 @@ Argument matchers can be used:
15
15
 
16
16
  #create a double
17
17
  obj = double()
18
-
18
+
19
19
  #expect a message with given args
20
20
  obj.should_receive(:message).with('an argument')
21
21
 
@@ -24,4 +24,4 @@ If more control is needed, one can use a block
24
24
  obj.should_receive(:message) do |arg1, arg2|
25
25
  # set expectations about the args in this block
26
26
  # and optionally set a return value
27
- end
27
+ end
@@ -46,7 +46,7 @@ Feature: explicit arguments
46
46
  object.foo(:this).should eq("got this")
47
47
  object.foo(:this, :that).should eq("got this and that")
48
48
  end
49
-
49
+
50
50
  it "works on mocks" do
51
51
  object = double('foo')
52
52
  object.should_receive(:foo).with(:this, :that)
@@ -56,5 +56,4 @@ Feature: explicit arguments
56
56
  end
57
57
  """
58
58
  When I run `rspec stub_multiple_explicit_args_spec.rb`
59
- Then the output should contain "2 examples, 0 failures"
60
-
59
+ Then the output should contain "2 examples, 0 failures"
@@ -1,6 +1,6 @@
1
1
  Feature: General matchers
2
2
 
3
- The `anything`, `any_args`, and `no_args` matchers can be used to require the method
3
+ The `anything`, `any_args`, and `no_args` matchers can be used to require the method
4
4
  to have arguments (or not) without constraining the details of the argument, such as its
5
5
  type, pattern or value. The `anything` matcher only reflects a single argument, while
6
6
  the `any_args` matcher matches any arity.
@@ -82,4 +82,4 @@ Feature: General matchers
82
82
  end
83
83
  """
84
84
  When I run `rspec stub_no_args_expectations_spec.rb`
85
- Then the output should contain "2 examples, 1 failure"
85
+ Then the output should contain "2 examples, 1 failure"
@@ -1,9 +1,9 @@
1
1
  Feature: stub with argument constraints
2
2
 
3
3
  You can further specify the behavior by constraining the type,
4
- format and/or number of arguments with the `#with()` method
4
+ format and/or number of arguments with the `#with()` method
5
5
  chained off of `#stub()`
6
-
6
+
7
7
  Scenario: an_instance_of argument matcher
8
8
  Given a file named "stub_an_instance_of_args_spec.rb" with:
9
9
  """ruby
@@ -23,5 +23,4 @@ Feature: stub with argument constraints
23
23
  end
24
24
  """
25
25
  When I run `rspec stub_an_instance_of_args_spec.rb`
26
- Then the output should contain "1 example, 0 failures"
27
-
26
+ Then the output should contain "1 example, 0 failures"
@@ -37,7 +37,7 @@ You can also use the block format:
37
37
  obj.should_receive(:message) { throw :this_symbol }
38
38
 
39
39
  ### Argument constraints
40
-
40
+
41
41
  #### Explicit arguments
42
42
 
43
43
  obj.should_receive(:message).with('an argument')
@@ -53,7 +53,7 @@ You can also use the block format:
53
53
 
54
54
  obj.should_receive(:message).with(/abc/)
55
55
 
56
- ### Counts
56
+ ### Counts
57
57
 
58
58
  obj.should_receive(:message).once
59
59
  obj.should_receive(:message).twice
@@ -2,7 +2,7 @@ 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
-
5
+
6
6
  The spec will fail if no instance receives a message.
7
7
 
8
8
  Scenario: expect a message on any instance of a class
@@ -18,4 +18,4 @@ Feature: expect a message on any instance of a class
18
18
  end
19
19
  """
20
20
  When I run `rspec example_spec.rb`
21
- Then the examples should all pass
21
+ Then the examples should all pass
@@ -32,9 +32,9 @@ Feature: block local expectations
32
32
  """
33
33
  When I run `rspec spec/account_spec.rb`
34
34
  Then the output should contain "1 example, 0 failures"
35
-
35
+
36
36
  Scenario: failing example
37
-
37
+
38
38
  Given a file named "spec/account_spec.rb" with:
39
39
  """
40
40
  require 'account'
@@ -52,4 +52,4 @@ Feature: block local expectations
52
52
  """
53
53
 
54
54
  When I run `rspec spec/account_spec.rb`
55
- Then the output should contain "1 example, 1 failure"
55
+ Then the output should contain "1 example, 1 failure"
@@ -0,0 +1,103 @@
1
+ Feature: expect message using `expect`
2
+
3
+ Use `expect(object).to receive(:message)` to set an expectation that
4
+ `object` should receive the message `:message` before the example is
5
+ completed.
6
+
7
+ Scenario: expect a message
8
+ Given a file named "spec/account_spec.rb" with:
9
+ """ruby
10
+ require "account"
11
+
12
+ describe Account do
13
+ context "when closed" do
14
+ it "logs an account closed message" do
15
+ logger = double("logger")
16
+ account = Account.new logger
17
+
18
+ expect(logger).to receive(:account_closed)
19
+
20
+ account.close
21
+ end
22
+ end
23
+ end
24
+ """
25
+ And a file named "lib/account.rb" with:
26
+ """ruby
27
+ Account = Struct.new(:logger) do
28
+ def close
29
+ logger.account_closed
30
+ end
31
+ end
32
+ """
33
+ When I run `rspec spec/account_spec.rb`
34
+ Then the output should contain "1 example, 0 failures"
35
+
36
+ Scenario: expect a message with an argument
37
+ Given a file named "spec/account_spec.rb" with:
38
+ """ruby
39
+ require "account"
40
+
41
+ describe Account do
42
+ context "when closed" do
43
+ it "logs an account closed message" do
44
+ logger = double("logger")
45
+ account = Account.new logger
46
+
47
+ expect(logger).to receive(:account_closed).with(account)
48
+
49
+ account.close
50
+ end
51
+ end
52
+ end
53
+ """
54
+ And a file named "lib/account.rb" with:
55
+ """ruby
56
+ Account = Struct.new(:logger) do
57
+ def close
58
+ logger.account_closed(self)
59
+ end
60
+ end
61
+ """
62
+ When I run `rspec spec/account_spec.rb`
63
+ Then the output should contain "1 example, 0 failures"
64
+
65
+ Scenario: provide a return value
66
+ Given a file named "spec/message_expectation_spec.rb" with:
67
+ """ruby
68
+
69
+ describe "a message expectation with a return value" do
70
+ context "specified in a block" do
71
+ it "returns the specified value" do
72
+ object = double("object")
73
+ expect(object).to receive(:message) { :return_value }
74
+ object.message.should eq(:return_value)
75
+ end
76
+ end
77
+
78
+ context "specified with and_return" do
79
+ it "returns the specified value" do
80
+ object = double("object")
81
+ expect(object).to receive(:message).and_return(:return_value)
82
+ object.message.should eq(:return_value)
83
+ end
84
+ end
85
+ end
86
+ """
87
+ When I run `rspec spec/message_expectation_spec.rb`
88
+ Then the output should contain "2 examples, 0 failures"
89
+
90
+ Scenario: expect a specific number of calls
91
+ Given a file named "spec/message_count_spec.rb" with:
92
+ """ruby
93
+ describe "a message expectation with a count" do
94
+ it "passes if the expected number of calls happen" do
95
+ string = "hi"
96
+ expect(string).to receive(:length).exactly(3).times
97
+
98
+ 3.times { string.length }
99
+ end
100
+ end
101
+ """
102
+ When I run `rspec spec/message_count_spec.rb`
103
+ Then the output should contain "1 example, 0 failures"
@@ -0,0 +1,118 @@
1
+ Feature: expect message using `should_receive`
2
+
3
+ Use `object.should_receive(:message)` to set an expectation that
4
+ `object` should receive the message `:message` before the example is
5
+ completed.
6
+
7
+ Background:
8
+ Given a file named "spec/spec_helper.rb" with:
9
+ """ruby
10
+ RSpec.configure do |config|
11
+ config.mock_with :rspec do |mocks|
12
+ mocks.syntax = :should
13
+ end
14
+ end
15
+ """
16
+
17
+ Scenario: expect a message
18
+ Given a file named "spec/account_spec.rb" with:
19
+ """ruby
20
+ require "account"
21
+ require "spec_helper"
22
+
23
+ describe Account do
24
+ context "when closed" do
25
+ it "logs an account closed message" do
26
+ logger = double("logger")
27
+ account = Account.new logger
28
+
29
+ logger.should_receive(:account_closed)
30
+
31
+ account.close
32
+ end
33
+ end
34
+ end
35
+ """
36
+ And a file named "lib/account.rb" with:
37
+ """ruby
38
+ Account = Struct.new(:logger) do
39
+ def close
40
+ logger.account_closed
41
+ end
42
+ end
43
+ """
44
+ When I run `rspec spec/account_spec.rb`
45
+ Then the output should contain "1 example, 0 failures"
46
+
47
+ Scenario: expect a message with an argument
48
+ Given a file named "spec/account_spec.rb" with:
49
+ """ruby
50
+ require "account"
51
+ require "spec_helper"
52
+
53
+ describe Account do
54
+ context "when closed" do
55
+ it "logs an account closed message" do
56
+ logger = double("logger")
57
+ account = Account.new logger
58
+
59
+ logger.should_receive(:account_closed).with(account)
60
+
61
+ account.close
62
+ end
63
+ end
64
+ end
65
+ """
66
+ And a file named "lib/account.rb" with:
67
+ """ruby
68
+ Account = Struct.new(:logger) do
69
+ def close
70
+ logger.account_closed(self)
71
+ end
72
+ end
73
+ """
74
+ When I run `rspec spec/account_spec.rb`
75
+ Then the output should contain "1 example, 0 failures"
76
+
77
+ Scenario: provide a return value
78
+ Given a file named "spec/message_expectation_spec.rb" with:
79
+ """ruby
80
+ require "spec_helper"
81
+
82
+ describe "a message expectation with a return value" do
83
+ context "specified in a block" do
84
+ it "returns the specified value" do
85
+ object = double("object")
86
+ object.should_receive(:message) { :return_value }
87
+ object.message.should eq(:return_value)
88
+ end
89
+ end
90
+
91
+ context "specified with and_return" do
92
+ it "returns the specified value" do
93
+ object = double("object")
94
+ object.should_receive(:message).and_return(:return_value)
95
+ object.message.should eq(:return_value)
96
+ end
97
+ end
98
+ end
99
+ """
100
+ When I run `rspec spec/message_expectation_spec.rb`
101
+ Then the output should contain "2 examples, 0 failures"
102
+
103
+ Scenario: expect a specific number of calls
104
+ Given a file named "spec/message_count_spec.rb" with:
105
+ """ruby
106
+ require "spec_helper"
107
+
108
+ describe "a message expectation with a count" do
109
+ it "passes if the expected number of calls happen" do
110
+ string = "hi"
111
+ string.should_receive(:length).exactly(3).times
112
+
113
+ 3.times { string.length }
114
+ end
115
+ end
116
+ """
117
+ When I run `rspec spec/message_count_spec.rb`
118
+ Then the output should contain "1 example, 0 failures"
@@ -176,7 +176,7 @@ Feature: receive counts
176
176
  end
177
177
  """
178
178
  When I run `rspec spec/account_spec.rb`
179
- Then the output should contain "expected: 1 time"
179
+ Then the output should contain "expected: at most 1 time"
180
180
  And the output should contain "received: 2 times"
181
181
 
182
182
  Scenario: expect a message at most (n) times
@@ -30,7 +30,7 @@ You can also use the block format:
30
30
  obj.stub(:message) { throw :this_symbol }
31
31
 
32
32
  ### Argument constraints
33
-
33
+
34
34
  #### Explicit arguments
35
35
 
36
36
  obj.stub(:message).with('an argument') { ... }
@@ -20,7 +20,7 @@ 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
-
23
+
24
24
  Scenario: any_instance stub with a hash
25
25
  Given a file named "example_spec.rb" with:
26
26
  """ruby
@@ -37,8 +37,8 @@ Feature: stub on any instance of a class
37
37
  end
38
38
  """
39
39
  When I run `rspec example_spec.rb`
40
- Then the examples should all pass
41
-
40
+ Then the examples should all pass
41
+
42
42
  Scenario: any_instance stub with specific arguments matchers
43
43
  Given a file named "example_spec.rb" with:
44
44
  """ruby
@@ -47,7 +47,7 @@ Feature: stub on any instance of a class
47
47
  it "returns the stubbed value when arguments match" do
48
48
  Object.any_instance.stub(:foo).with(:param_one, :param_two).and_return(:result_one)
49
49
  Object.any_instance.stub(:foo).with(:param_three, :param_four).and_return(:result_two)
50
-
50
+
51
51
  o = Object.new
52
52
  o.foo(:param_one, :param_two).should eq(:result_one)
53
53
  o.foo(:param_three, :param_four).should eq(:result_two)
@@ -57,7 +57,7 @@ Feature: stub on any instance of a class
57
57
  """
58
58
  When I run `rspec example_spec.rb`
59
59
  Then the examples should all pass
60
-
60
+
61
61
  Scenario: any_instance unstub
62
62
  Given a file named "example_spec.rb" with:
63
63
  """ruby
@@ -68,7 +68,7 @@ Feature: stub on any instance of a class
68
68
  :foo
69
69
  end
70
70
  end
71
-
71
+
72
72
  Object.any_instance.stub(:foo)
73
73
  Object.any_instance.unstub(:foo)
74
74
 
@@ -77,8 +77,8 @@ Feature: stub on any instance of a class
77
77
  end
78
78
  """
79
79
  When I run `rspec example_spec.rb`
80
- Then the examples should all pass
81
-
80
+ Then the examples should all pass
81
+
82
82
  Scenario: any_instance unstub
83
83
  Given a file named "example_spec.rb" with:
84
84
  """ruby
@@ -93,7 +93,7 @@ Feature: stub on any instance of a class
93
93
  Object.any_instance.should_receive(:foo).and_return(:bar)
94
94
  Object.any_instance.stub(:foo)
95
95
  Object.any_instance.unstub(:foo)
96
-
96
+
97
97
  Object.new.foo.should eq(:bar)
98
98
  end
99
99
  end
@@ -101,7 +101,7 @@ Feature: stub on any instance of a class
101
101
  """
102
102
  When I run `rspec example_spec.rb`
103
103
  Then the examples should all pass
104
-
104
+
105
105
  Scenario: stub a chain of methods an any instance
106
106
  Given a file named "stub_chain_spec.rb" with:
107
107
  """ruby
@@ -129,4 +129,4 @@ Feature: stub on any instance of a class
129
129
  end
130
130
  """
131
131
  When I run `rspec stub_chain_spec.rb`
132
- Then the examples should all pass
132
+ Then the examples should all pass