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

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,19 +29,19 @@ end
29
29
  describe "should have(n).items" do
30
30
  include HaveSpecHelper
31
31
 
32
- it "should pass if target has a collection of items with n members" do
32
+ it "passes if target has a collection of items with n members" do
33
33
  owner = create_collection_owner_with(3)
34
34
  owner.should have(3).items_in_collection_with_length_method
35
35
  owner.should have(3).items_in_collection_with_size_method
36
36
  end
37
37
 
38
- it "should convert :no to 0" do
38
+ it "converts :no to 0" do
39
39
  owner = create_collection_owner_with(0)
40
40
  owner.should have(:no).items_in_collection_with_length_method
41
41
  owner.should have(:no).items_in_collection_with_size_method
42
42
  end
43
43
 
44
- it "should fail if target has a collection of items with < n members" do
44
+ it "fails if target has a collection of items with < n members" do
45
45
  owner = create_collection_owner_with(3)
46
46
  lambda {
47
47
  owner.should have(4).items_in_collection_with_length_method
@@ -51,7 +51,7 @@ describe "should have(n).items" do
51
51
  }.should fail_with("expected 4 items_in_collection_with_size_method, got 3")
52
52
  end
53
53
 
54
- it "should fail if target has a collection of items with > n members" do
54
+ it "fails if target has a collection of items with > n members" do
55
55
  owner = create_collection_owner_with(3)
56
56
  lambda {
57
57
  owner.should have(2).items_in_collection_with_length_method
@@ -65,7 +65,7 @@ end
65
65
  describe 'should have(1).item when ActiveSupport::Inflector is defined' do
66
66
  include HaveSpecHelper
67
67
 
68
- it 'should pluralize the collection name' do
68
+ it 'pluralizes the collection name' do
69
69
  owner = create_collection_owner_with(1)
70
70
  owner.should have(1).item
71
71
  end
@@ -93,7 +93,7 @@ describe 'should have(1).item when Inflector is defined' do
93
93
  end
94
94
  end
95
95
 
96
- it 'should pluralize the collection name' do
96
+ it 'pluralizes the collection name' do
97
97
  owner = create_collection_owner_with(1)
98
98
  owner.should have(1).item
99
99
  end
@@ -106,7 +106,7 @@ describe 'should have(1).item when Inflector is defined' do
106
106
  end
107
107
 
108
108
  describe "should have(n).items where result responds to items but returns something other than a collection" do
109
- it "should provide a meaningful error" do
109
+ it "provides a meaningful error" do
110
110
  owner = Class.new do
111
111
  def items
112
112
  Object.new
@@ -121,19 +121,19 @@ end
121
121
  describe "should_not have(n).items" do
122
122
  include HaveSpecHelper
123
123
 
124
- it "should pass if target has a collection of items with < n members" do
124
+ it "passes if target has a collection of items with < n members" do
125
125
  owner = create_collection_owner_with(3)
126
126
  owner.should_not have(4).items_in_collection_with_length_method
127
127
  owner.should_not have(4).items_in_collection_with_size_method
128
128
  end
129
129
 
130
- it "should pass if target has a collection of items with > n members" do
130
+ it "passes if target has a collection of items with > n members" do
131
131
  owner = create_collection_owner_with(3)
132
132
  owner.should_not have(2).items_in_collection_with_length_method
133
133
  owner.should_not have(2).items_in_collection_with_size_method
134
134
  end
135
135
 
136
- it "should fail if target has a collection of items with n members" do
136
+ it "fails if target has a collection of items with n members" do
137
137
  owner = create_collection_owner_with(3)
138
138
  lambda {
139
139
  owner.should_not have(3).items_in_collection_with_length_method
@@ -147,19 +147,19 @@ end
147
147
  describe "should have_exactly(n).items" do
148
148
  include HaveSpecHelper
149
149
 
150
- it "should pass if target has a collection of items with n members" do
150
+ it "passes if target has a collection of items with n members" do
151
151
  owner = create_collection_owner_with(3)
152
152
  owner.should have_exactly(3).items_in_collection_with_length_method
153
153
  owner.should have_exactly(3).items_in_collection_with_size_method
154
154
  end
155
155
 
156
- it "should convert :no to 0" do
156
+ it "converts :no to 0" do
157
157
  owner = create_collection_owner_with(0)
158
158
  owner.should have_exactly(:no).items_in_collection_with_length_method
159
159
  owner.should have_exactly(:no).items_in_collection_with_size_method
160
160
  end
161
161
 
162
- it "should fail if target has a collection of items with < n members" do
162
+ it "fails if target has a collection of items with < n members" do
163
163
  owner = create_collection_owner_with(3)
164
164
  lambda {
165
165
  owner.should have_exactly(4).items_in_collection_with_length_method
@@ -169,7 +169,7 @@ describe "should have_exactly(n).items" do
169
169
  }.should fail_with("expected 4 items_in_collection_with_size_method, got 3")
170
170
  end
171
171
 
172
- it "should fail if target has a collection of items with > n members" do
172
+ it "fails if target has a collection of items with > n members" do
173
173
  owner = create_collection_owner_with(3)
174
174
  lambda {
175
175
  owner.should have_exactly(2).items_in_collection_with_length_method
@@ -183,19 +183,19 @@ end
183
183
  describe "should have_at_least(n).items" do
184
184
  include HaveSpecHelper
185
185
 
186
- it "should pass if target has a collection of items with n members" do
186
+ it "passes if target has a collection of items with n members" do
187
187
  owner = create_collection_owner_with(3)
188
188
  owner.should have_at_least(3).items_in_collection_with_length_method
189
189
  owner.should have_at_least(3).items_in_collection_with_size_method
190
190
  end
191
191
 
192
- it "should pass if target has a collection of items with > n members" do
192
+ it "passes if target has a collection of items with > n members" do
193
193
  owner = create_collection_owner_with(3)
194
194
  owner.should have_at_least(2).items_in_collection_with_length_method
195
195
  owner.should have_at_least(2).items_in_collection_with_size_method
196
196
  end
197
197
 
198
- it "should fail if target has a collection of items with < n members" do
198
+ it "fails if target has a collection of items with < n members" do
199
199
  owner = create_collection_owner_with(3)
200
200
  lambda {
201
201
  owner.should have_at_least(4).items_in_collection_with_length_method
@@ -205,7 +205,7 @@ describe "should have_at_least(n).items" do
205
205
  }.should fail_with("expected at least 4 items_in_collection_with_size_method, got 3")
206
206
  end
207
207
 
208
- it "should provide educational negative failure messages" do
208
+ it "provides educational negative failure messages" do
209
209
  #given
210
210
  owner = create_collection_owner_with(3)
211
211
  length_matcher = have_at_least(3).items_in_collection_with_length_method
@@ -237,13 +237,13 @@ end
237
237
  describe "should have_at_most(n).items" do
238
238
  include HaveSpecHelper
239
239
 
240
- it "should pass if target has a collection of items with n members" do
240
+ it "passes if target has a collection of items with n members" do
241
241
  owner = create_collection_owner_with(3)
242
242
  owner.should have_at_most(3).items_in_collection_with_length_method
243
243
  owner.should have_at_most(3).items_in_collection_with_size_method
244
244
  end
245
245
 
246
- it "should fail if target has a collection of items with > n members" do
246
+ it "fails if target has a collection of items with > n members" do
247
247
  owner = create_collection_owner_with(3)
248
248
  lambda {
249
249
  owner.should have_at_most(2).items_in_collection_with_length_method
@@ -253,13 +253,13 @@ describe "should have_at_most(n).items" do
253
253
  }.should fail_with("expected at most 2 items_in_collection_with_size_method, got 3")
254
254
  end
255
255
 
256
- it "should pass if target has a collection of items with < n members" do
256
+ it "passes if target has a collection of items with < n members" do
257
257
  owner = create_collection_owner_with(3)
258
258
  owner.should have_at_most(4).items_in_collection_with_length_method
259
259
  owner.should have_at_most(4).items_in_collection_with_size_method
260
260
  end
261
261
 
262
- it "should provide educational negative failure messages" do
262
+ it "provides educational negative failure messages" do
263
263
  #given
264
264
  owner = create_collection_owner_with(3)
265
265
  length_matcher = have_at_most(3).items_in_collection_with_length_method
@@ -289,13 +289,13 @@ EOF
289
289
  end
290
290
 
291
291
  describe "have(n).items(args, block)" do
292
- it "should pass args to target" do
292
+ it "passes args to target" do
293
293
  target = mock("target")
294
294
  target.should_receive(:items).with("arg1","arg2").and_return([1,2,3])
295
295
  target.should have(3).items("arg1","arg2")
296
296
  end
297
297
 
298
- it "should pass block to target" do
298
+ it "passes block to target" do
299
299
  target = mock("target")
300
300
  block = lambda { 5 }
301
301
  target.should_receive(:items).with("arg1","arg2", block).and_return([1,2,3])
@@ -304,27 +304,27 @@ describe "have(n).items(args, block)" do
304
304
  end
305
305
 
306
306
  describe "have(n).items where target IS a collection" do
307
- it "should reference the number of items IN the collection" do
307
+ it "references the number of items IN the collection" do
308
308
  [1,2,3].should have(3).items
309
309
  end
310
310
 
311
- it "should fail when the number of items IN the collection is not as expected" do
311
+ it "fails when the number of items IN the collection is not as expected" do
312
312
  lambda { [1,2,3].should have(7).items }.should fail_with("expected 7 items, got 3")
313
313
  end
314
314
  end
315
315
 
316
316
  describe "have(n).characters where target IS a String" do
317
- it "should pass if the length is correct" do
317
+ it "passes if the length is correct" do
318
318
  "this string".should have(11).characters
319
319
  end
320
320
 
321
- it "should fail if the length is incorrect" do
321
+ it "fails if the length is incorrect" do
322
322
  lambda { "this string".should have(12).characters }.should fail_with("expected 12 characters, got 11")
323
323
  end
324
324
  end
325
325
 
326
326
  describe "have(n).things on an object which is not a collection nor contains one" do
327
- it "should fail" do
327
+ it "fails" do
328
328
  lambda { Object.new.should have(2).things }.should raise_error(NoMethodError, /undefined method `things' for #<Object:/)
329
329
  end
330
330
  end
@@ -338,19 +338,19 @@ describe RSpec::Matchers::Have, "for a collection owner that implements #send" d
338
338
  def @collection.send(*args); raise "DOH! Library developers shouldn't use #send!" end
339
339
  end
340
340
 
341
- it "should work in the straightforward case" do
341
+ it "works in the straightforward case" do
342
342
  lambda {
343
343
  @collection.should have(2).floozles
344
344
  }.should_not raise_error
345
345
  end
346
346
 
347
- it "should work when doing automatic pluralization" do
347
+ it "works when doing automatic pluralization" do
348
348
  lambda {
349
349
  @collection.should have_at_least(1).floozle
350
350
  }.should_not raise_error
351
351
  end
352
352
 
353
- it "should blow up when the owner doesn't respond to that method" do
353
+ it "blows up when the owner doesn't respond to that method" do
354
354
  lambda {
355
355
  @collection.should have(99).problems
356
356
  }.should raise_error(NoMethodError, /problems/)
@@ -360,7 +360,7 @@ end
360
360
  module RSpec
361
361
  module Matchers
362
362
  describe Have do
363
- it "should have method_missing as private" do
363
+ it "has method_missing as private" do
364
364
  with_ruby 1.8 do
365
365
  described_class.private_instance_methods.should include("method_missing")
366
366
  end
@@ -369,7 +369,7 @@ module RSpec
369
369
  end
370
370
  end
371
371
 
372
- it "should not respond_to? method_missing (because it's private)" do
372
+ it "does not respond_to? method_missing (because it's private)" do
373
373
  formatter = described_class.new({ }, StringIO.new)
374
374
  formatter.should_not respond_to(:method_missing)
375
375
  end
@@ -381,24 +381,24 @@ module RSpec
381
381
  @a_method_which_object_defines = Object.instance_methods.first
382
382
  end
383
383
 
384
- it "should be true for a method which Have defines" do
384
+ it "is true for a method which Have defines" do
385
385
  @have.should respond_to(@a_method_which_have_defines)
386
386
  end
387
387
 
388
- it "should be true for a method that it's superclass (Object) defines" do
388
+ it "is true for a method that it's superclass (Object) defines" do
389
389
  @have.should respond_to(@a_method_which_object_defines)
390
390
  end
391
391
 
392
- it "should be false for a method which neither Object nor nor Have defines" do
392
+ it "is false for a method which neither Object nor nor Have defines" do
393
393
  @have.should_not respond_to(:foo_bar_baz)
394
394
  end
395
395
 
396
- it "should be false if the owner doesn't respond to the method" do
396
+ it "is false if the owner doesn't respond to the method" do
397
397
  have = Have.new(99)
398
398
  have.should_not respond_to(:problems)
399
399
  end
400
400
 
401
- it "should be true if the owner responds to the method" do
401
+ it "is true if the owner responds to the method" do
402
402
  have = Have.new(:a_symbol)
403
403
  have.should respond_to(:to_sym)
404
404
  end
@@ -1,16 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "should include(expected)" do
4
- it "should pass if target includes expected" do
4
+ it "passes if target includes expected" do
5
5
  [1,2,3].should include(3)
6
6
  "abc".should include("a")
7
7
  end
8
8
 
9
- it 'should pass if target is a Hash and has the expected as a key' do
9
+ it 'passes if target is a Hash and has the expected as a key' do
10
10
  {:key => 'value'}.should include(:key)
11
11
  end
12
12
 
13
- it "should fail if target does not include expected" do
13
+ it "fails if target does not include expected" do
14
14
  lambda {
15
15
  [1,2,3].should include(4)
16
16
  }.should fail_with("expected [1, 2, 3] to include 4")
@@ -24,21 +24,21 @@ describe "should include(expected)" do
24
24
  end
25
25
 
26
26
  describe "should include(with, multiple, args)" do
27
- it "should pass if target includes all items" do
27
+ it "passes if target includes all items" do
28
28
  [1,2,3].should include(1,2,3)
29
29
  end
30
30
 
31
- it 'should pass if target is a Hash including all items as keys' do
31
+ it 'passes if target is a Hash including all items as keys' do
32
32
  {:key => 'value', :other => 'value'}.should include(:key, :other)
33
33
  end
34
34
 
35
- it "should fail if target does not include any one of the items" do
35
+ it "fails if target does not include any one of the items" do
36
36
  lambda {
37
37
  [1,2,3].should include(1,2,4)
38
38
  }.should fail_with("expected [1, 2, 3] to include 1, 2, and 4")
39
39
  end
40
40
 
41
- it 'should pass if target is a Hash missing any item as a key' do
41
+ it 'passes if target is a Hash missing any item as a key' do
42
42
  lambda {
43
43
  {:key => 'value'}.should include(:key, :other)
44
44
  }.should fail_with(%Q|expected {:key=>"value"} to include :key and :other|)
@@ -46,16 +46,16 @@ describe "should include(with, multiple, args)" do
46
46
  end
47
47
 
48
48
  describe "should_not include(expected)" do
49
- it "should pass if target does not include expected" do
49
+ it "passes if target does not include expected" do
50
50
  [1,2,3].should_not include(4)
51
51
  "abc".should_not include("d")
52
52
  end
53
53
 
54
- it 'should pass if target is a Hash and does not have the expected as a key' do
54
+ it 'passes if target is a Hash and does not have the expected as a key' do
55
55
  {:other => 'value'}.should_not include(:key)
56
56
  end
57
57
 
58
- it "should fail if target includes expected" do
58
+ it "fails if target includes expected" do
59
59
  lambda {
60
60
  [1,2,3].should_not include(3)
61
61
  }.should fail_with("expected [1, 2, 3] not to include 3")
@@ -69,18 +69,18 @@ describe "should_not include(expected)" do
69
69
  end
70
70
 
71
71
  describe "should include(:key => value)" do
72
- it "should pass if target is a Hash and includes the key/value pair" do
72
+ it "passes if target is a Hash and includes the key/value pair" do
73
73
  {:key => 'value'}.should include(:key => 'value')
74
74
  end
75
- it "should pass if target is a Hash and includes the key/value pair among others" do
75
+ it "passes if target is a Hash and includes the key/value pair among others" do
76
76
  {:key => 'value', :other => 'different'}.should include(:key => 'value')
77
77
  end
78
- it "should fail if target is a Hash and has a different value for key" do
78
+ it "fails if target is a Hash and has a different value for key" do
79
79
  lambda {
80
80
  {:key => 'different'}.should include(:key => 'value')
81
81
  }.should fail_with(%Q|expected {:key=>"different"} to include {:key=>"value"}|)
82
82
  end
83
- it "should fail if target is a Hash and has a different key" do
83
+ it "fails if target is a Hash and has a different key" do
84
84
  lambda {
85
85
  {:other => 'value'}.should include(:key => 'value')
86
86
  }.should fail_with(%Q|expected {:other=>"value"} to include {:key=>"value"}|)
@@ -18,15 +18,15 @@ class UnsortableObject
18
18
  end
19
19
 
20
20
  describe "array.should =~ other_array" do
21
- it "should pass if target contains all items" do
21
+ it "passes if target contains all items" do
22
22
  [1,2,3].should =~ [1,2,3]
23
23
  end
24
24
 
25
- it "should pass if target contains all items out of order" do
25
+ it "passes if target contains all items out of order" do
26
26
  [1,3,2].should =~ [1,2,3]
27
27
  end
28
28
 
29
- it "should fail if target includes extra items" do
29
+ it "fails if target includes extra items" do
30
30
  lambda {
31
31
  [1,2,3,4].should =~ [1,2,3]
32
32
  }.should fail_with(<<-MESSAGE)
@@ -36,7 +36,7 @@ the extra elements were: [4]
36
36
  MESSAGE
37
37
  end
38
38
 
39
- it "should fail if target is missing items" do
39
+ it "fails if target is missing items" do
40
40
  lambda {
41
41
  [1,2].should =~ [1,2,3]
42
42
  }.should fail_with(<<-MESSAGE)
@@ -46,7 +46,7 @@ the missing elements were: [3]
46
46
  MESSAGE
47
47
  end
48
48
 
49
- it "should fail if target is missing items and has extra items" do
49
+ it "fails if target is missing items and has extra items" do
50
50
 
51
51
  lambda {
52
52
  [1,2,4].should =~ [1,2,3]
@@ -58,7 +58,7 @@ the extra elements were: [4]
58
58
  MESSAGE
59
59
  end
60
60
 
61
- it "should sort items in the error message if they all respond to <=>" do
61
+ it "sorts items in the error message if they all respond to <=>" do
62
62
  lambda {
63
63
  [6,2,1,5].should =~ [4,1,2,3]
64
64
  }.should fail_with(<<-MESSAGE)
@@ -69,7 +69,7 @@ the extra elements were: [5, 6]
69
69
  MESSAGE
70
70
  end
71
71
 
72
- it "should not sort items in the error message if they don't all respond to <=>" do
72
+ it "does not sort items in the error message if they don't all respond to <=>" do
73
73
  lambda {
74
74
  [UnsortableObject.new(2), UnsortableObject.new(1)].should =~ [UnsortableObject.new(4), UnsortableObject.new(3)]
75
75
  }.should fail_with(<<-MESSAGE)
@@ -80,7 +80,7 @@ the extra elements were: [2, 1]
80
80
  MESSAGE
81
81
  end
82
82
 
83
- it "should accurately report extra elements when there are duplicates" do
83
+ it "accurately reports extra elements when there are duplicates" do
84
84
  lambda {
85
85
  [1,1,1,5].should =~ [1,5]
86
86
  }.should fail_with(<<-MESSAGE)
@@ -90,7 +90,7 @@ the extra elements were: [1, 1]
90
90
  MESSAGE
91
91
  end
92
92
 
93
- it "should accurately report missing elements when there are duplicates" do
93
+ it "accurately reports missing elements when there are duplicates" do
94
94
  lambda {
95
95
  [1,5].should =~ [1,1,5]
96
96
  }.should fail_with(<<-MESSAGE)
@@ -103,7 +103,7 @@ MESSAGE
103
103
  end
104
104
 
105
105
  describe "should_not =~ [:with, :multiple, :args]" do
106
- it "should not be supported" do
106
+ it "is not supported" do
107
107
  lambda {
108
108
  [1,2,3].should_not =~ [1,2,3]
109
109
  }.should fail_with(/Matcher does not support should_not/)