rspec-mocks 2.13.1 → 2.14.0.rc1

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 (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
@@ -26,7 +26,7 @@ module RSpec
26
26
  expect(@double.do_something).to eq @return_values[0]
27
27
  expect(@double.do_something).to eq @return_values[1]
28
28
  expect(@double.do_something).to eq @return_values[2]
29
- @double.rspec_verify
29
+ verify @double
30
30
  end
31
31
 
32
32
  it "falls back to a previously stubbed value" do
@@ -40,7 +40,7 @@ module RSpec
40
40
  it "fails when there are too few calls (if there is no stub)" do
41
41
  @double.do_something
42
42
  @double.do_something
43
- expect { @double.rspec_verify }.to raise_error
43
+ expect { verify @double }.to raise_error
44
44
  end
45
45
 
46
46
  it "fails when there are too many calls (if there is no stub)" do
@@ -48,7 +48,7 @@ module RSpec
48
48
  @double.do_something
49
49
  @double.do_something
50
50
  @double.do_something
51
- expect { @double.rspec_verify }.to raise_error
51
+ expect { verify @double }.to raise_error
52
52
  end
53
53
  end
54
54
 
@@ -63,7 +63,7 @@ module RSpec
63
63
  expect(@double.do_something).to eq @return_values[0]
64
64
  expect(@double.do_something).to eq @return_values[1]
65
65
  expect(@double.do_something).to eq @return_values[2]
66
- @double.rspec_verify
66
+ verify @double
67
67
  end
68
68
  end
69
69
 
@@ -77,12 +77,12 @@ module RSpec
77
77
  expect(@double.do_something).to equal(11)
78
78
  expect(@double.do_something).to equal(22)
79
79
  expect(@double.do_something).to equal(22)
80
- @double.rspec_verify
80
+ verify @double
81
81
  end
82
82
 
83
83
  it "fails when called less than the specified number" do
84
84
  expect(@double.do_something).to equal(11)
85
- expect { @double.rspec_verify }.to raise_error(RSpec::Mocks::MockExpectationError)
85
+ expect { verify @double }.to raise_error(RSpec::Mocks::MockExpectationError)
86
86
  end
87
87
 
88
88
  context "when method is stubbed too" do
@@ -92,12 +92,12 @@ module RSpec
92
92
  expect(@double.do_something).to equal(11)
93
93
  expect(@double.do_something).to equal(22)
94
94
  expect(@double.do_something).to equal(22)
95
- @double.rspec_verify
95
+ verify @double
96
96
  end
97
97
 
98
98
  it "fails when called less than the specified number" do
99
99
  expect(@double.do_something).to equal(11)
100
- expect { @double.rspec_verify }.to raise_error(RSpec::Mocks::MockExpectationError)
100
+ expect { verify @double }.to raise_error(RSpec::Mocks::MockExpectationError)
101
101
  end
102
102
  end
103
103
  end
@@ -112,13 +112,13 @@ module RSpec
112
112
  expect(@double.do_something).to equal(11)
113
113
  expect(@double.do_something).to equal(22)
114
114
  expect(@double.do_something).to equal(22)
115
- @double.rspec_verify
115
+ verify @double
116
116
  end
117
117
 
118
118
  it "fails when called less than the specified number" do
119
119
  @double.do_something
120
120
  @double.do_something
121
- expect { @double.rspec_verify }.to raise_error
121
+ expect { verify @double }.to raise_error
122
122
  end
123
123
 
124
124
  it "fails fast when called greater than the specified number" do
@@ -12,6 +12,13 @@ class TestClass
12
12
  end
13
13
  end
14
14
 
15
+ class TestClassThatDefinesSend
16
+ C = :c
17
+
18
+ def self.send
19
+ end
20
+ end
21
+
15
22
  class TestSubClass < TestClass
16
23
  P = :p
17
24
  end
@@ -46,7 +53,7 @@ module RSpec
46
53
  after { change_const_value_to(original_const_value) }
47
54
 
48
55
  def change_const_value_to(value)
49
- parent_const.send(:remove_const, last_const_part)
56
+ parent_const.__send__(:remove_const, last_const_part)
50
57
  parent_const.const_set(last_const_part, value)
51
58
  end
52
59
 
@@ -143,6 +150,11 @@ module RSpec
143
150
  end
144
151
 
145
152
  describe "#hide_const" do
153
+ context "for a loaded constant nested in a module that redefines `send`" do
154
+ it_behaves_like "loaded constant hiding", "TestClassThatDefinesSend::C"
155
+ end
156
+
157
+
146
158
  context 'for a loaded nested constant' do
147
159
  it_behaves_like "loaded constant hiding", "TestClass::Nested"
148
160
  end
@@ -205,6 +217,10 @@ module RSpec
205
217
  end
206
218
 
207
219
  describe "#stub_const" do
220
+ context "for a loaded constant nested in a module that redefines `send`" do
221
+ it_behaves_like "loaded constant stubbing", "TestClassThatDefinesSend::C"
222
+ end
223
+
208
224
  context 'for a loaded unnested constant' do
209
225
  it_behaves_like "loaded constant stubbing", "TestClass"
210
226
 
@@ -309,6 +325,10 @@ module RSpec
309
325
  it_behaves_like 'unloaded constant stubbing', "::SomeUndefinedConst"
310
326
  end
311
327
 
328
+ context "for an unloaded constant nested in a module that redefines `send`" do
329
+ it_behaves_like 'unloaded constant stubbing', "TestClassThatDefinesSend::SomeUndefinedConst"
330
+ end
331
+
312
332
  context 'for an unloaded constant with nested name that matches a top-level constant' do
313
333
  it_behaves_like "unloaded constant stubbing", "TestClass::Hash"
314
334
  end
@@ -43,18 +43,24 @@ module RSpec
43
43
  end
44
44
 
45
45
  describe "#allow_message_expectations_on_nil" do
46
- it "does not effect subsequent examples" do
47
- example_group = empty_example_group
46
+ it "does not affect subsequent examples" do
47
+ example_group = ::RSpec::Core::ExampleGroup.describe
48
+ reporter = ::RSpec.configuration.reporter
48
49
  example_group.it("when called in one example that doesn't end up setting an expectation on nil") do
49
50
  allow_message_expectations_on_nil
50
51
  end
51
- example_group.it("should not effect the next exapmle ran") do
52
+ example_group.it("should not effect the next example ran") do
52
53
  Kernel.should_receive(:warn)
53
54
  nil.should_receive(:foo)
54
55
  nil.foo
55
56
  end
56
57
 
57
- example_group
58
+ expect(example_group.run reporter).to eq true
59
+ end
60
+
61
+ it 'doesnt error when marshalled' do
62
+ allow_message_expectations_on_nil
63
+ expect(Marshal.dump(nil)).to eq Marshal.dump_without_mocks(nil)
58
64
  end
59
65
  end
60
66
  end
@@ -60,13 +60,13 @@ module RSpec
60
60
  it "fails verification when explicit exception not met" do
61
61
  expect {
62
62
  @double.should_receive(:something)
63
- @double.rspec_verify
63
+ verify @double
64
64
  }.to raise_error(RSpec::Mocks::MockExpectationError)
65
65
  end
66
66
 
67
67
  it "ignores unexpected methods" do
68
68
  @double.random_call("a", "d", "c")
69
- @double.rspec_verify
69
+ verify @double
70
70
  end
71
71
 
72
72
  it "allows expected message with different args first" do
@@ -103,5 +103,14 @@ module RSpec
103
103
  expect(obj).not_to be_null_object
104
104
  end
105
105
  end
106
+
107
+ describe "when using the :expect syntax" do
108
+ include_context "with syntax", :expect
109
+
110
+ it 'still supports null object doubles' do
111
+ obj = double("foo").as_null_object
112
+ expect(obj.foo.bar.bazz).to be(obj)
113
+ end
114
+ end
106
115
  end
107
116
  end
@@ -10,19 +10,19 @@ module RSpec
10
10
  it "passes when called once" do
11
11
  @double.should_receive(:do_something).once
12
12
  @double.do_something
13
- @double.rspec_verify
13
+ verify @double
14
14
  end
15
15
 
16
16
  it "passes when called once with specified args" do
17
17
  @double.should_receive(:do_something).once.with("a", "b", "c")
18
18
  @double.do_something("a", "b", "c")
19
- @double.rspec_verify
19
+ verify @double
20
20
  end
21
21
 
22
22
  it "passes when called once with unspecified args" do
23
23
  @double.should_receive(:do_something).once
24
24
  @double.do_something("a", "b", "c")
25
- @double.rspec_verify
25
+ verify @double
26
26
  end
27
27
 
28
28
  it "fails when called with wrong args" do
@@ -30,7 +30,7 @@ module RSpec
30
30
  expect {
31
31
  @double.do_something("d", "e", "f")
32
32
  }.to raise_error(RSpec::Mocks::MockExpectationError)
33
- @double.rspec_reset
33
+ reset @double
34
34
  end
35
35
 
36
36
  it "fails fast when called twice" do
@@ -44,7 +44,7 @@ module RSpec
44
44
  it "fails when not called" do
45
45
  @double.should_receive(:do_something).once
46
46
  expect {
47
- @double.rspec_verify
47
+ verify @double
48
48
  }.to raise_error(RSpec::Mocks::MockExpectationError)
49
49
  end
50
50
  end
@@ -7,10 +7,10 @@ module RSpec
7
7
  begin
8
8
  mock = RSpec::Mocks::Mock.new("a mock")
9
9
  mock.should_receive(:message, :expected_from => "/path/to/blah.ext:37")
10
- mock.rspec_verify
10
+ verify mock
11
11
  rescue Exception => e
12
12
  ensure
13
- expect(e.backtrace.to_s).to match /\/path\/to\/blah.ext:37/m
13
+ expect(e.backtrace.to_s).to match(/\/path\/to\/blah.ext:37/m)
14
14
  end
15
15
  end
16
16
 
@@ -18,7 +18,7 @@ module RSpec
18
18
  expect {
19
19
  m = RSpec::Mocks::Mock.new("a mock")
20
20
  m.should_receive(:message, :message => "recebi nada")
21
- m.rspec_verify
21
+ verify m
22
22
  }.to raise_error("recebi nada")
23
23
  end
24
24
 
@@ -27,7 +27,7 @@ module RSpec
27
27
  m = RSpec::Mocks::Mock.new("a mock")
28
28
  m.stub(:message)
29
29
  m.should_receive(:message, :message => "from mock")
30
- m.rspec_verify
30
+ verify m
31
31
  }.to raise_error("from mock")
32
32
  end
33
33
  end
@@ -8,14 +8,14 @@ module RSpec
8
8
  it "names the class in the failure message" do
9
9
  object.should_receive(:foo)
10
10
  expect do
11
- object.rspec_verify
11
+ verify object
12
12
  end.to raise_error(RSpec::Mocks::MockExpectationError, /\(#<Object:.*>\).foo/)
13
13
  end
14
14
 
15
15
  it "names the class in the failure message when expectation is on class" do
16
16
  Object.should_receive(:foo)
17
17
  expect {
18
- Object.rspec_verify
18
+ verify Object
19
19
  }.to raise_error(RSpec::Mocks::MockExpectationError, /<Object \(class\)>/)
20
20
  end
21
21
 
@@ -31,7 +31,7 @@ module RSpec
31
31
  object.fuhbar
32
32
  }.to raise_error(
33
33
  RSpec::Mocks::MockExpectationError,
34
- /expected\: 0 times\n received\: 1 time/
34
+ /expected\: 0 times with any arguments\n received\: 1 time/
35
35
  )
36
36
  end
37
37
 
@@ -63,7 +63,7 @@ module RSpec
63
63
  it "should_receive verifies method was called" do
64
64
  object.should_receive(:foobar).with(:test_param).and_return(1)
65
65
  expect {
66
- object.rspec_verify
66
+ verify object
67
67
  }.to raise_error(RSpec::Mocks::MockExpectationError)
68
68
  end
69
69
 
@@ -85,10 +85,10 @@ module RSpec
85
85
  _nil = nil
86
86
  _nil.should_receive(:foobar)
87
87
  expect {
88
- _nil.rspec_verify
88
+ verify _nil
89
89
  }.to raise_error(
90
90
  RSpec::Mocks::MockExpectationError,
91
- %Q|(nil).foobar(any args)\n expected: 1 time\n received: 0 times|
91
+ %Q|(nil).foobar(any args)\n expected: 1 time with any arguments\n received: 0 times with any arguments|
92
92
  )
93
93
  end
94
94
 
@@ -125,17 +125,26 @@ module RSpec
125
125
  end
126
126
  end
127
127
 
128
- let(:instance) { proxy_class.new(Object.new) }
128
+ let(:wrapped_object) { Object.new }
129
+ let(:proxy) { proxy_class.new(wrapped_object) }
129
130
 
130
131
  it 'works properly' do
131
- instance.should_receive(:proxied?).and_return(false)
132
- expect(instance).not_to be_proxied
132
+ proxy.should_receive(:proxied?).and_return(false)
133
+ expect(proxy).not_to be_proxied
134
+ end
135
+
136
+ it 'does not confuse the proxy and the proxied object' do
137
+ proxy.stub(:foo).and_return(:proxy_foo)
138
+ wrapped_object.stub(:foo).and_return(:wrapped_foo)
139
+
140
+ expect(proxy.foo).to eq(:proxy_foo)
141
+ expect(wrapped_object.foo).to eq(:wrapped_foo)
133
142
  end
134
143
  end
135
144
 
136
145
  describe "Partially mocking an object that defines ==, after another mock has been defined" do
137
146
  before(:each) do
138
- stub("existing mock", :foo => :foo)
147
+ double("existing mock", :foo => :foo)
139
148
  end
140
149
 
141
150
  let(:klass) do
@@ -153,7 +162,7 @@ module RSpec
153
162
 
154
163
  it "does not raise an error when stubbing the object" do
155
164
  o = klass.new :foo
156
- expect { o.stub(:bar) }.not_to raise_error(NoMethodError)
165
+ expect { o.stub(:bar) }.not_to raise_error
157
166
  end
158
167
  end
159
168
 
@@ -31,7 +31,7 @@ module RSpec::Mocks
31
31
  # specify "should clear expectations on verify" do
32
32
  # obj.should_receive(:msg)
33
33
  # obj.msg
34
- # obj.rspec_verify
34
+ # verify obj
35
35
  # expect {
36
36
  # obj.msg
37
37
  # }.to raise_error(NoMethodError)
@@ -40,7 +40,7 @@ module RSpec::Mocks
40
40
  it "fails when expected message is not received" do
41
41
  obj.should_receive(:msg)
42
42
  expect {
43
- obj.rspec_verify
43
+ verify obj
44
44
  }.to raise_error(RSpec::Mocks::MockExpectationError)
45
45
  end
46
46
 
@@ -55,20 +55,20 @@ module RSpec::Mocks
55
55
  it "passes when expected message is received" do
56
56
  obj.should_receive(:msg)
57
57
  obj.msg
58
- obj.rspec_verify
58
+ verify obj
59
59
  end
60
60
 
61
61
  it "passes when message is received with correct args" do
62
62
  obj.should_receive(:msg).with(:correct_arg)
63
63
  obj.msg(:correct_arg)
64
- obj.rspec_verify
64
+ verify obj
65
65
  end
66
66
 
67
67
  it "restores the original method if it existed" do
68
68
  expect(obj.existing_method).to equal(:original_value)
69
69
  obj.should_receive(:existing_method).and_return(:mock_value)
70
70
  expect(obj.existing_method).to equal(:mock_value)
71
- obj.rspec_verify
71
+ verify obj
72
72
  expect(obj.existing_method).to equal(:original_value)
73
73
  end
74
74
 
@@ -77,7 +77,7 @@ module RSpec::Mocks
77
77
  expect(obj.captured_by_method_missing).to eq("response generated by method missing")
78
78
  obj.stub(:captured_by_method_missing) { "foo" }
79
79
  expect(obj.captured_by_method_missing).to eq("foo")
80
- obj.rspec_reset
80
+ reset obj
81
81
  expect(obj.captured_by_method_missing).to eq("response generated by method missing")
82
82
  end
83
83
  end
@@ -87,7 +87,7 @@ module RSpec::Mocks
87
87
  expect(klass.captured_by_method_missing).to eq("response generated by method missing")
88
88
  klass.stub(:captured_by_method_missing) { "foo" }
89
89
  expect(klass.captured_by_method_missing).to eq("foo")
90
- klass.rspec_reset
90
+ reset klass
91
91
  expect(klass.captured_by_method_missing).to eq("response generated by method missing")
92
92
  end
93
93
  end
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  module RSpec
4
4
  module Mocks
5
- describe Methods do
5
+ describe "Passing argument matchers" do
6
6
  before(:each) do
7
7
  @double = double('double')
8
8
  Kernel.stub(:warn)
9
9
  end
10
10
 
11
11
  after(:each) do
12
- @double.rspec_verify
12
+ verify @double
13
13
  end
14
14
 
15
15
  context "handling argument matchers" do
@@ -12,7 +12,7 @@ module RSpec
12
12
  @double.do_something
13
13
  @double.do_something
14
14
  expect {
15
- @double.rspec_verify
15
+ verify @double
16
16
  }.to raise_error(RSpec::Mocks::MockExpectationError)
17
17
  end
18
18
 
@@ -29,7 +29,7 @@ module RSpec
29
29
  it "fails when exactly n times method is never called" do
30
30
  @double.should_receive(:do_something).exactly(3).times
31
31
  expect {
32
- @double.rspec_verify
32
+ verify @double
33
33
  }.to raise_error(RSpec::Mocks::MockExpectationError)
34
34
  end
35
35
 
@@ -38,13 +38,13 @@ module RSpec
38
38
  @double.do_something
39
39
  @double.do_something
40
40
  @double.do_something
41
- @double.rspec_verify
41
+ verify @double
42
42
  end
43
43
 
44
44
  it "returns the value given by a block when the exactly once method is called" do
45
45
  @double.should_receive(:to_s).exactly(:once) { "testing" }
46
46
  expect(@double.to_s).to eq "testing"
47
- @double.rspec_verify
47
+ verify @double
48
48
  end
49
49
 
50
50
  it "passes mutiple calls with different args" do
@@ -52,7 +52,7 @@ module RSpec
52
52
  @double.should_receive(:do_something).once.with(2)
53
53
  @double.do_something(1)
54
54
  @double.do_something(2)
55
- @double.rspec_verify
55
+ verify @double
56
56
  end
57
57
 
58
58
  it "passes multiple calls with different args and counts" do
@@ -61,7 +61,7 @@ module RSpec
61
61
  @double.do_something(1)
62
62
  @double.do_something(2)
63
63
  @double.do_something(1)
64
- @double.rspec_verify
64
+ verify @double
65
65
  end
66
66
  end
67
67
  end