rspec-mocks 2.0.0.beta.19 → 2.0.0.beta.20

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 (44) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +0 -7
  3. data/VERSION +1 -1
  4. data/lib/rspec/mocks/argument_expectation.rb +7 -10
  5. data/lib/rspec/mocks/extensions/instance_exec.rb +3 -3
  6. data/lib/rspec/mocks/message_expectation.rb +26 -26
  7. data/lib/rspec/mocks/methods.rb +22 -6
  8. data/lib/rspec/mocks/mock.rb +3 -3
  9. data/lib/rspec/mocks/proxy.rb +10 -10
  10. data/rspec-mocks.gemspec +9 -15
  11. data/spec/rspec/mocks/any_number_of_times_spec.rb +4 -4
  12. data/spec/rspec/mocks/argument_expectation_spec.rb +4 -4
  13. data/spec/rspec/mocks/at_least_spec.rb +11 -11
  14. data/spec/rspec/mocks/at_most_spec.rb +11 -11
  15. data/spec/rspec/mocks/bug_report_10260_spec.rb +1 -1
  16. data/spec/rspec/mocks/bug_report_11545_spec.rb +3 -3
  17. data/spec/rspec/mocks/bug_report_15719_spec.rb +2 -2
  18. data/spec/rspec/mocks/bug_report_600_spec.rb +2 -2
  19. data/spec/rspec/mocks/bug_report_7611_spec.rb +1 -1
  20. data/spec/rspec/mocks/bug_report_8165_spec.rb +2 -2
  21. data/spec/rspec/mocks/bug_report_957_spec.rb +2 -2
  22. data/spec/rspec/mocks/failing_argument_matchers_spec.rb +12 -12
  23. data/spec/rspec/mocks/hash_including_matcher_spec.rb +18 -18
  24. data/spec/rspec/mocks/hash_not_including_matcher_spec.rb +13 -13
  25. data/spec/rspec/mocks/mock_ordering_spec.rb +7 -7
  26. data/spec/rspec/mocks/mock_space_spec.rb +4 -4
  27. data/spec/rspec/mocks/mock_spec.rb +65 -65
  28. data/spec/rspec/mocks/multiple_return_value_spec.rb +11 -11
  29. data/spec/rspec/mocks/nil_expectation_warning_spec.rb +4 -4
  30. data/spec/rspec/mocks/null_object_mock_spec.rb +7 -7
  31. data/spec/rspec/mocks/once_counts_spec.rb +6 -6
  32. data/spec/rspec/mocks/options_hash_spec.rb +3 -3
  33. data/spec/rspec/mocks/partial_mock_spec.rb +17 -17
  34. data/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb +1 -1
  35. data/spec/rspec/mocks/passing_argument_matchers_spec.rb +20 -20
  36. data/spec/rspec/mocks/precise_counts_spec.rb +5 -5
  37. data/spec/rspec/mocks/record_messages_spec.rb +4 -4
  38. data/spec/rspec/mocks/stash_spec.rb +1 -1
  39. data/spec/rspec/mocks/stub_chain_spec.rb +13 -0
  40. data/spec/rspec/mocks/stub_implementation_spec.rb +4 -4
  41. data/spec/rspec/mocks/stub_spec.rb +26 -26
  42. data/spec/spec_helper.rb +2 -2
  43. data/spec/support/macros.rb +2 -2
  44. metadata +17 -27
@@ -13,7 +13,7 @@ module RSpec
13
13
  @double.rspec_reset
14
14
  end
15
15
 
16
- it "should pass two calls in order" do
16
+ it "passes two calls in order" do
17
17
  @double.should_receive(:one).ordered
18
18
  @double.should_receive(:two).ordered
19
19
  @double.one
@@ -21,7 +21,7 @@ module RSpec
21
21
  @double.rspec_verify
22
22
  end
23
23
 
24
- it "should pass three calls in order" do
24
+ it "passes three calls in order" do
25
25
  @double.should_receive(:one).ordered
26
26
  @double.should_receive(:two).ordered
27
27
  @double.should_receive(:three).ordered
@@ -31,7 +31,7 @@ module RSpec
31
31
  @double.rspec_verify
32
32
  end
33
33
 
34
- it "should fail if second call comes first" do
34
+ it "fails if second call comes first" do
35
35
  @double.should_receive(:one).ordered
36
36
  @double.should_receive(:two).ordered
37
37
  lambda do
@@ -39,7 +39,7 @@ module RSpec
39
39
  end.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :two out of order")
40
40
  end
41
41
 
42
- it "should fail if third call comes first" do
42
+ it "fails if third call comes first" do
43
43
  @double.should_receive(:one).ordered
44
44
  @double.should_receive(:two).ordered
45
45
  @double.should_receive(:three).ordered
@@ -49,7 +49,7 @@ module RSpec
49
49
  end.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :three out of order")
50
50
  end
51
51
 
52
- it "should fail if third call comes second" do
52
+ it "fails if third call comes second" do
53
53
  @double.should_receive(:one).ordered
54
54
  @double.should_receive(:two).ordered
55
55
  @double.should_receive(:three).ordered
@@ -59,7 +59,7 @@ module RSpec
59
59
  end.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :three out of order")
60
60
  end
61
61
 
62
- it "should ignore order of non ordered calls" do
62
+ it "ignores order of non ordered calls" do
63
63
  @double.should_receive(:ignored_0)
64
64
  @double.should_receive(:ordered_1).ordered
65
65
  @double.should_receive(:ignored_1)
@@ -79,7 +79,7 @@ module RSpec
79
79
  @double.rspec_verify
80
80
  end
81
81
 
82
- it "should pass when duplicates exist" do
82
+ it "passes when duplicates exist" do
83
83
  @double.should_receive(:a).ordered
84
84
  @double.should_receive(:b).ordered
85
85
  @double.should_receive(:a).ordered
@@ -23,26 +23,26 @@ module RSpec
23
23
  @m1 = klazz.new
24
24
  @m2 = klazz.new
25
25
  end
26
- it "should verify all mocks within" do
26
+ it "verifies all mocks within" do
27
27
  @space.add(@m1)
28
28
  @space.add(@m2)
29
29
  @space.verify_all
30
30
  @m1.should be_verified
31
31
  @m2.should be_verified
32
32
  end
33
- it "should reset all mocks within" do
33
+ it "resets all mocks within" do
34
34
  @space.add(m1 = double("mock1"))
35
35
  @space.add(m2 = double("mock2"))
36
36
  m1.should_receive(:rspec_reset)
37
37
  m2.should_receive(:rspec_reset)
38
38
  @space.reset_all
39
39
  end
40
- it "should clear internal mocks on reset_all" do
40
+ it "clears internal mocks on reset_all" do
41
41
  @space.add(m = double("mock"))
42
42
  @space.reset_all
43
43
  @space.instance_eval { mocks.empty? }.should be_true
44
44
  end
45
- it "should only add an instance once" do
45
+ it "only adds an instance once" do
46
46
  @space.add(m1 = double("mock1"))
47
47
  @space.add(m1)
48
48
  m1.should_receive(:rspec_verify)
@@ -13,7 +13,7 @@ module RSpec
13
13
  @mock.rspec_reset
14
14
  end
15
15
 
16
- it "should report line number of expectation of unreceived message" do
16
+ it "reports line number of expectation of unreceived message" do
17
17
  expected_error_line = __LINE__; @mock.should_receive(:wont_happen).with("x", 3)
18
18
  begin
19
19
  @mock.rspec_verify
@@ -24,7 +24,7 @@ module RSpec
24
24
  end
25
25
  end
26
26
 
27
- it "should report line number of expectation of unreceived message after #should_receive after similar stub" do
27
+ it "reports line number of expectation of unreceived message after #should_receive after similar stub" do
28
28
  @mock.stub(:wont_happen)
29
29
  expected_error_line = __LINE__; @mock.should_receive(:wont_happen).with("x", 3)
30
30
  begin
@@ -36,19 +36,19 @@ module RSpec
36
36
  end
37
37
  end
38
38
 
39
- it "should pass when not receiving message specified as not to be received" do
39
+ it "passes when not receiving message specified as not to be received" do
40
40
  @mock.should_not_receive(:not_expected)
41
41
  @mock.rspec_verify
42
42
  end
43
43
 
44
- it "should pass when receiving message specified as not to be received with different args" do
44
+ it "passes when receiving message specified as not to be received with different args" do
45
45
  @mock.should_not_receive(:message).with("unwanted text")
46
46
  @mock.should_receive(:message).with("other text")
47
47
  @mock.message "other text"
48
48
  @mock.rspec_verify
49
49
  end
50
50
 
51
- it "should fail when receiving message specified as not to be received" do
51
+ it "fails when receiving message specified as not to be received" do
52
52
  @mock.should_not_receive(:not_expected)
53
53
  expect {
54
54
  @mock.not_expected
@@ -59,7 +59,7 @@ module RSpec
59
59
  )
60
60
  end
61
61
 
62
- it "should fail when receiving message specified as not to be received with args" do
62
+ it "fails when receiving message specified as not to be received with args" do
63
63
  @mock.should_not_receive(:not_expected).with("unexpected text")
64
64
  expect {
65
65
  @mock.not_expected("unexpected text")
@@ -70,31 +70,31 @@ module RSpec
70
70
  )
71
71
  end
72
72
 
73
- it "should pass when receiving message specified as not to be received with wrong args" do
73
+ it "passes when receiving message specified as not to be received with wrong args" do
74
74
  @mock.should_not_receive(:not_expected).with("unexpected text")
75
75
  @mock.not_expected "really unexpected text"
76
76
  @mock.rspec_verify
77
77
  end
78
78
 
79
- it "should allow block to calculate return values" do
79
+ it "allows block to calculate return values" do
80
80
  @mock.should_receive(:something).with("a","b","c").and_return { |a,b,c| c+b+a }
81
81
  @mock.something("a","b","c").should == "cba"
82
82
  @mock.rspec_verify
83
83
  end
84
84
 
85
- it "should allow parameter as return value" do
85
+ it "allows parameter as return value" do
86
86
  @mock.should_receive(:something).with("a","b","c").and_return("booh")
87
87
  @mock.something("a","b","c").should == "booh"
88
88
  @mock.rspec_verify
89
89
  end
90
90
 
91
- it "should return nil if no return value set" do
91
+ it "returns nil if no return value set" do
92
92
  @mock.should_receive(:something).with("a","b","c")
93
93
  @mock.something("a","b","c").should be_nil
94
94
  @mock.rspec_verify
95
95
  end
96
96
 
97
- it "should raise exception if args don't match when method called" do
97
+ it "raises exception if args don't match when method called" do
98
98
  @mock.should_receive(:something).with("a","b","c").and_return("booh")
99
99
  lambda {
100
100
  @mock.something("a","d","c")
@@ -102,7 +102,7 @@ module RSpec
102
102
  }.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n expected: (\"a\", \"b\", \"c\")\n got: (\"a\", \"d\", \"c\")")
103
103
  end
104
104
 
105
- it "should raise exception if args don't match when method called even when the method is stubbed" do
105
+ it "raises exception if args don't match when method called even when the method is stubbed" do
106
106
  @mock.stub(:something)
107
107
  @mock.should_receive(:something).with("a","b","c")
108
108
  lambda {
@@ -111,7 +111,7 @@ module RSpec
111
111
  }.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n expected: (\"a\", \"b\", \"c\")\n got: (\"a\", \"d\", \"c\")")
112
112
  end
113
113
 
114
- it "should raise exception if args don't match when method called even when using null_object" do
114
+ it "raises exception if args don't match when method called even when using null_object" do
115
115
  @mock = double("test double").as_null_object
116
116
  @mock.should_receive(:something).with("a","b","c")
117
117
  lambda {
@@ -120,14 +120,14 @@ module RSpec
120
120
  }.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n expected: (\"a\", \"b\", \"c\")\n got: (\"a\", \"d\", \"c\")")
121
121
  end
122
122
 
123
- it "should fail if unexpected method called" do
123
+ it "fails if unexpected method called" do
124
124
  lambda {
125
125
  @mock.something("a","b","c")
126
126
  violated
127
127
  }.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received unexpected message :something with (\"a\", \"b\", \"c\")")
128
128
  end
129
129
 
130
- it "should use block for expectation if provided" do
130
+ it "uses block for expectation if provided" do
131
131
  @mock.should_receive(:something) do | a, b |
132
132
  a.should == "a"
133
133
  b.should == "b"
@@ -137,14 +137,14 @@ module RSpec
137
137
  @mock.rspec_verify
138
138
  end
139
139
 
140
- it "should fail if expectation block fails" do
140
+ it "fails if expectation block fails" do
141
141
  @mock.should_receive(:something) {| bool | bool.should be_true}
142
142
  expect {
143
143
  @mock.something false
144
144
  }.to raise_error(RSpec::Mocks::MockExpectationError, /Double \"test double\" received :something but passed block failed with: expected false to be true/)
145
145
  end
146
146
 
147
- it "should fail right away when method defined as never is received" do
147
+ it "fails right away when method defined as never is received" do
148
148
  @mock.should_receive(:not_expected).never
149
149
  expect { @mock.not_expected }.to raise_error(
150
150
  RSpec::Mocks::MockExpectationError,
@@ -152,7 +152,7 @@ module RSpec
152
152
  )
153
153
  end
154
154
 
155
- it "should eventually fail when method defined as never is received" do
155
+ it "eventually fails when method defined as never is received" do
156
156
  @mock.should_receive(:not_expected).never
157
157
  expect { @mock.not_expected }.to raise_error(
158
158
  RSpec::Mocks::MockExpectationError,
@@ -160,14 +160,14 @@ module RSpec
160
160
  )
161
161
  end
162
162
 
163
- it "should raise when told to" do
163
+ it "raises when told to" do
164
164
  @mock.should_receive(:something).and_raise(RuntimeError)
165
165
  lambda do
166
166
  @mock.something
167
167
  end.should raise_error(RuntimeError)
168
168
  end
169
169
 
170
- it "should raise passed an Exception instance" do
170
+ it "raises passed an Exception instance" do
171
171
  error = RuntimeError.new("error message")
172
172
  @mock.should_receive(:something).and_raise(error)
173
173
  lambda {
@@ -175,28 +175,28 @@ module RSpec
175
175
  }.should raise_error(RuntimeError, "error message")
176
176
  end
177
177
 
178
- it "should raise RuntimeError with passed message" do
178
+ it "raises RuntimeError with passed message" do
179
179
  @mock.should_receive(:something).and_raise("error message")
180
180
  lambda {
181
181
  @mock.something
182
182
  }.should raise_error(RuntimeError, "error message")
183
183
  end
184
184
 
185
- it "should not raise when told to if args dont match" do
185
+ it "does not raise when told to if args dont match" do
186
186
  @mock.should_receive(:something).with(2).and_raise(RuntimeError)
187
187
  lambda {
188
188
  @mock.something 1
189
189
  }.should raise_error(RSpec::Mocks::MockExpectationError)
190
190
  end
191
191
 
192
- it "should throw when told to" do
192
+ it "throws when told to" do
193
193
  @mock.should_receive(:something).and_throw(:blech)
194
194
  lambda {
195
195
  @mock.something
196
196
  }.should throw_symbol(:blech)
197
197
  end
198
198
 
199
- it "should raise when explicit return and block constrained" do
199
+ it "raises when explicit return and block constrained" do
200
200
  lambda {
201
201
  @mock.should_receive(:fruit) do |colour|
202
202
  :strawberry
@@ -204,7 +204,7 @@ module RSpec
204
204
  }.should raise_error(RSpec::Mocks::AmbiguousReturnError)
205
205
  end
206
206
 
207
- it "should ignore args on any args" do
207
+ it "ignores args on any args" do
208
208
  @mock.should_receive(:something).at_least(:once).with(any_args)
209
209
  @mock.something
210
210
  @mock.something 1
@@ -213,27 +213,27 @@ module RSpec
213
213
  @mock.rspec_verify
214
214
  end
215
215
 
216
- it "should fail on no args if any args received" do
216
+ it "fails on no args if any args received" do
217
217
  @mock.should_receive(:something).with(no_args())
218
218
  lambda {
219
219
  @mock.something 1
220
220
  }.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n expected: (no args)\n got: (1)")
221
221
  end
222
222
 
223
- it "should fail when args are expected but none are received" do
223
+ it "fails when args are expected but none are received" do
224
224
  @mock.should_receive(:something).with(1)
225
225
  lambda {
226
226
  @mock.something
227
227
  }.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n expected: (1)\n got: (no args)")
228
228
  end
229
229
 
230
- it "should return value from block by default" do
230
+ it "returns value from block by default" do
231
231
  @mock.stub(:method_that_yields).and_yield
232
232
  @mock.method_that_yields { :returned_obj }.should == :returned_obj
233
233
  @mock.rspec_verify
234
234
  end
235
235
 
236
- it "should yield 0 args to blocks that take a variable number of arguments" do
236
+ it "yields 0 args to blocks that take a variable number of arguments" do
237
237
  @mock.should_receive(:yield_back).with(no_args()).once.and_yield
238
238
  a = nil
239
239
  @mock.yield_back {|*x| a = x}
@@ -241,7 +241,7 @@ module RSpec
241
241
  @mock.rspec_verify
242
242
  end
243
243
 
244
- it "should yield 0 args multiple times to blocks that take a variable number of arguments" do
244
+ it "yields 0 args multiple times to blocks that take a variable number of arguments" do
245
245
  @mock.should_receive(:yield_back).once.with(no_args()).once.and_yield.
246
246
  and_yield
247
247
  a = nil
@@ -251,7 +251,7 @@ module RSpec
251
251
  @mock.rspec_verify
252
252
  end
253
253
 
254
- it "should yield one arg to blocks that take a variable number of arguments" do
254
+ it "yields one arg to blocks that take a variable number of arguments" do
255
255
  @mock.should_receive(:yield_back).with(no_args()).once.and_yield(99)
256
256
  a = nil
257
257
  @mock.yield_back {|*x| a = x}
@@ -259,7 +259,7 @@ module RSpec
259
259
  @mock.rspec_verify
260
260
  end
261
261
 
262
- it "should yield one arg 3 times consecutively to blocks that take a variable number of arguments" do
262
+ it "yields one arg 3 times consecutively to blocks that take a variable number of arguments" do
263
263
  @mock.should_receive(:yield_back).once.with(no_args()).once.and_yield(99).
264
264
  and_yield(43).
265
265
  and_yield("something fruity")
@@ -270,7 +270,7 @@ module RSpec
270
270
  @mock.rspec_verify
271
271
  end
272
272
 
273
- it "should yield many args to blocks that take a variable number of arguments" do
273
+ it "yields many args to blocks that take a variable number of arguments" do
274
274
  @mock.should_receive(:yield_back).with(no_args()).once.and_yield(99, 27, "go")
275
275
  a = nil
276
276
  @mock.yield_back {|*x| a = x}
@@ -278,7 +278,7 @@ module RSpec
278
278
  @mock.rspec_verify
279
279
  end
280
280
 
281
- it "should yield many args 3 times consecutively to blocks that take a variable number of arguments" do
281
+ it "yields many args 3 times consecutively to blocks that take a variable number of arguments" do
282
282
  @mock.should_receive(:yield_back).once.with(no_args()).once.and_yield(99, :green, "go").
283
283
  and_yield("wait", :amber).
284
284
  and_yield("stop", 12, :red)
@@ -289,7 +289,7 @@ module RSpec
289
289
  @mock.rspec_verify
290
290
  end
291
291
 
292
- it "should yield single value" do
292
+ it "yields single value" do
293
293
  @mock.should_receive(:yield_back).with(no_args()).once.and_yield(99)
294
294
  a = nil
295
295
  @mock.yield_back {|x| a = x}
@@ -297,7 +297,7 @@ module RSpec
297
297
  @mock.rspec_verify
298
298
  end
299
299
 
300
- it "should yield single value 3 times consecutively" do
300
+ it "yields single value 3 times consecutively" do
301
301
  @mock.should_receive(:yield_back).once.with(no_args()).once.and_yield(99).
302
302
  and_yield(43).
303
303
  and_yield("something fruity")
@@ -308,7 +308,7 @@ module RSpec
308
308
  @mock.rspec_verify
309
309
  end
310
310
 
311
- it "should yield two values" do
311
+ it "yields two values" do
312
312
  @mock.should_receive(:yield_back).with(no_args()).once.and_yield('wha', 'zup')
313
313
  a, b = nil
314
314
  @mock.yield_back {|x,y| a=x; b=y}
@@ -317,7 +317,7 @@ module RSpec
317
317
  @mock.rspec_verify
318
318
  end
319
319
 
320
- it "should yield two values 3 times consecutively" do
320
+ it "yields two values 3 times consecutively" do
321
321
  @mock.should_receive(:yield_back).once.with(no_args()).once.and_yield('wha', 'zup').
322
322
  and_yield('not', 'down').
323
323
  and_yield(14, 65)
@@ -328,14 +328,14 @@ module RSpec
328
328
  @mock.rspec_verify
329
329
  end
330
330
 
331
- it "should fail when calling yielding method with wrong arity" do
331
+ it "fails when calling yielding method with wrong arity" do
332
332
  @mock.should_receive(:yield_back).with(no_args()).once.and_yield('wha', 'zup')
333
333
  lambda {
334
334
  @mock.yield_back {|a|}
335
335
  }.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" yielded |\"wha\", \"zup\"| to block with arity of 1")
336
336
  end
337
337
 
338
- it "should fail when calling yielding method consecutively with wrong arity" do
338
+ it "fails when calling yielding method consecutively with wrong arity" do
339
339
  @mock.should_receive(:yield_back).once.with(no_args()).once.and_yield('wha', 'zup').
340
340
  and_yield('down').
341
341
  and_yield(14, 65)
@@ -346,20 +346,20 @@ module RSpec
346
346
  }.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" yielded |\"down\"| to block with arity of 2")
347
347
  end
348
348
 
349
- it "should fail when calling yielding method without block" do
349
+ it "fails when calling yielding method without block" do
350
350
  @mock.should_receive(:yield_back).with(no_args()).once.and_yield('wha', 'zup')
351
351
  lambda {
352
352
  @mock.yield_back
353
353
  }.should raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" asked to yield |[\"wha\", \"zup\"]| but no block was passed")
354
354
  end
355
355
 
356
- it "should be able to mock send" do
356
+ it "is able to mock send" do
357
357
  @mock.should_receive(:send).with(any_args)
358
358
  @mock.send 'hi'
359
359
  @mock.rspec_verify
360
360
  end
361
361
 
362
- it "should be able to raise from method calling yielding mock" do
362
+ it "is able to raise from method calling yielding mock" do
363
363
  @mock.should_receive(:yield_me).and_yield 44
364
364
 
365
365
  lambda {
@@ -371,7 +371,7 @@ module RSpec
371
371
  @mock.rspec_verify
372
372
  end
373
373
 
374
- it "should clear expectations after verify" do
374
+ it "clears expectations after verify" do
375
375
  @mock.should_receive(:foobar)
376
376
  @mock.foobar
377
377
  @mock.rspec_verify
@@ -380,14 +380,14 @@ module RSpec
380
380
  }.should raise_error(RSpec::Mocks::MockExpectationError, %q|Double "test double" received unexpected message :foobar with (no args)|)
381
381
  end
382
382
 
383
- it "should restore objects to their original state on rspec_reset" do
383
+ it "restores objects to their original state on rspec_reset" do
384
384
  mock = double("this is a mock")
385
385
  mock.should_receive(:blah)
386
386
  mock.rspec_reset
387
387
  mock.rspec_verify #should throw if reset didn't work
388
388
  end
389
389
 
390
- it "should work even after method_missing starts raising NameErrors instead of NoMethodErrors" do
390
+ it "works even after method_missing starts raising NameErrors instead of NoMethodErrors" do
391
391
  # Object#method_missing throws either NameErrors or NoMethodErrors.
392
392
  #
393
393
  # On a fresh ruby program Object#method_missing:
@@ -416,7 +416,7 @@ module RSpec
416
416
  lambda { @mock.foobar }.should raise_error(RSpec::Mocks::MockExpectationError)
417
417
  end
418
418
 
419
- it "should temporarily replace a method stub on a mock" do
419
+ it "temporarily replaces a method stub on a mock" do
420
420
  @mock.stub(:msg).and_return(:stub_value)
421
421
  @mock.should_receive(:msg).with(:arg).and_return(:mock_value)
422
422
  @mock.msg(:arg).should equal(:mock_value)
@@ -425,7 +425,7 @@ module RSpec
425
425
  @mock.rspec_verify
426
426
  end
427
427
 
428
- it "should not require a different signature to replace a method stub" do
428
+ it "does not require a different signature to replace a method stub" do
429
429
  @mock.stub(:msg).and_return(:stub_value)
430
430
  @mock.should_receive(:msg).and_return(:mock_value)
431
431
  @mock.msg(:arg).should equal(:mock_value)
@@ -434,13 +434,13 @@ module RSpec
434
434
  @mock.rspec_verify
435
435
  end
436
436
 
437
- it "should raise an error when a previously stubbed method has a negative expectation" do
437
+ it "raises an error when a previously stubbed method has a negative expectation" do
438
438
  @mock.stub(:msg).and_return(:stub_value)
439
439
  @mock.should_not_receive(:msg).and_return(:mock_value)
440
440
  lambda {@mock.msg(:arg)}.should raise_error(RSpec::Mocks::MockExpectationError)
441
441
  end
442
442
 
443
- it "should temporarily replace a method stub on a non-mock" do
443
+ it "temporarily replaces a method stub on a non-mock" do
444
444
  non_mock = Object.new
445
445
  non_mock.stub(:msg).and_return(:stub_value)
446
446
  non_mock.should_receive(:msg).with(:arg).and_return(:mock_value)
@@ -450,21 +450,21 @@ module RSpec
450
450
  non_mock.rspec_verify
451
451
  end
452
452
 
453
- it "should return the stubbed value when no new value specified" do
453
+ it "returns the stubbed value when no new value specified" do
454
454
  @mock.stub(:msg).and_return(:stub_value)
455
455
  @mock.should_receive(:msg)
456
456
  @mock.msg.should equal(:stub_value)
457
457
  @mock.rspec_verify
458
458
  end
459
459
 
460
- it "should return the stubbed value when stubbed with args and no new value specified" do
460
+ it "returns the stubbed value when stubbed with args and no new value specified" do
461
461
  @mock.stub(:msg).with(:arg).and_return(:stub_value)
462
462
  @mock.should_receive(:msg).with(:arg)
463
463
  @mock.msg(:arg).should equal(:stub_value)
464
464
  @mock.rspec_verify
465
465
  end
466
466
 
467
- it "should not mess with the stub's yielded values when also mocked" do
467
+ it "does not mess with the stub's yielded values when also mocked" do
468
468
  @mock.stub(:yield_back).and_yield(:stub_value)
469
469
  @mock.should_receive(:yield_back).and_yield(:mock_value)
470
470
  @mock.yield_back{|v| v.should == :mock_value }
@@ -472,7 +472,7 @@ module RSpec
472
472
  @mock.rspec_verify
473
473
  end
474
474
 
475
- it "should yield multiple values after a similar stub" do
475
+ it "yields multiple values after a similar stub" do
476
476
  File.stub(:open).and_yield(:stub_value)
477
477
  File.should_receive(:open).and_yield(:first_call).and_yield(:second_call)
478
478
  yielded_args = []
@@ -482,7 +482,7 @@ module RSpec
482
482
  File.rspec_verify
483
483
  end
484
484
 
485
- it "should assign stub return values" do
485
+ it "assigns stub return values" do
486
486
  mock = RSpec::Mocks::Mock.new('name', :message => :response)
487
487
  mock.message.should == :response
488
488
  end
@@ -499,7 +499,7 @@ module RSpec
499
499
  @calls = @calls + 1
500
500
  end
501
501
 
502
- it "should call the block after #should_receive" do
502
+ it "calls the block after #should_receive" do
503
503
  @mock.should_receive(:foo) { add_call }
504
504
 
505
505
  @mock.foo
@@ -507,7 +507,7 @@ module RSpec
507
507
  @calls.should == 1
508
508
  end
509
509
 
510
- it "should call the block after #should_receive after a similar stub" do
510
+ it "calls the block after #should_receive after a similar stub" do
511
511
  @mock.stub(:foo).and_return(:bar)
512
512
  @mock.should_receive(:foo) { add_call }
513
513
 
@@ -516,7 +516,7 @@ module RSpec
516
516
  @calls.should == 1
517
517
  end
518
518
 
519
- it "should call the block after #once" do
519
+ it "calls the block after #once" do
520
520
  @mock.should_receive(:foo).once { add_call }
521
521
 
522
522
  @mock.foo
@@ -524,7 +524,7 @@ module RSpec
524
524
  @calls.should == 1
525
525
  end
526
526
 
527
- it "should call the block after #twice" do
527
+ it "calls the block after #twice" do
528
528
  @mock.should_receive(:foo).twice { add_call }
529
529
 
530
530
  @mock.foo
@@ -533,7 +533,7 @@ module RSpec
533
533
  @calls.should == 2
534
534
  end
535
535
 
536
- it "should call the block after #times" do
536
+ it "calls the block after #times" do
537
537
  @mock.should_receive(:foo).exactly(10).times { add_call }
538
538
 
539
539
  (1..10).each { @mock.foo }
@@ -541,7 +541,7 @@ module RSpec
541
541
  @calls.should == 10
542
542
  end
543
543
 
544
- it "should call the block after #any_number_of_times" do
544
+ it "calls the block after #any_number_of_times" do
545
545
  @mock.should_receive(:foo).any_number_of_times { add_call }
546
546
 
547
547
  (1..7).each { @mock.foo }
@@ -549,7 +549,7 @@ module RSpec
549
549
  @calls.should == 7
550
550
  end
551
551
 
552
- it "should call the block after #ordered" do
552
+ it "calls the block after #ordered" do
553
553
  @mock.should_receive(:foo).ordered { add_call }
554
554
  @mock.should_receive(:bar).ordered { add_call }
555
555
 
@@ -561,7 +561,7 @@ module RSpec
561
561
  end
562
562
 
563
563
  describe 'string representation generated by #to_s' do
564
- it 'should not contain < because that might lead to invalid HTML in some situations' do
564
+ it 'does not contain < because that might lead to invalid HTML in some situations' do
565
565
  mock = double("Dog")
566
566
  valid_html_str = "#{mock}"
567
567
  valid_html_str.should_not include('<')
@@ -576,12 +576,12 @@ module RSpec
576
576
  end
577
577
 
578
578
  describe "mock created with no name" do
579
- it "should not use a name in a failure message" do
579
+ it "does not use a name in a failure message" do
580
580
  mock = double()
581
581
  expect {mock.foo}.to raise_error(/Double received/)
582
582
  end
583
583
 
584
- it "should respond to initially stubbed methods" do
584
+ it "does respond to initially stubbed methods" do
585
585
  double = double(:foo => "woo", :bar => "car")
586
586
  double.foo.should == "woo"
587
587
  double.bar.should == "car"