apipie-rails 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/.rubocop_todo.yml +22 -99
  4. data/CHANGELOG.md +11 -0
  5. data/apipie-rails.gemspec +1 -0
  6. data/lib/apipie/error_description.rb +7 -5
  7. data/lib/apipie/extractor/recorder.rb +3 -3
  8. data/lib/apipie/extractor/writer.rb +6 -6
  9. data/lib/apipie/generator/swagger/param_description/in.rb +1 -1
  10. data/lib/apipie/generator/swagger/type_extractor.rb +1 -1
  11. data/lib/apipie/generator/swagger/warning.rb +2 -2
  12. data/lib/apipie/helpers.rb +1 -1
  13. data/lib/apipie/response_description.rb +10 -5
  14. data/lib/apipie/routes_formatter.rb +1 -1
  15. data/lib/apipie/version.rb +1 -1
  16. data/lib/tasks/apipie.rake +4 -4
  17. data/spec/controllers/api/v1/architectures_controller_spec.rb +3 -3
  18. data/spec/controllers/api/v2/nested/resources_controller_spec.rb +1 -1
  19. data/spec/controllers/concerns_controller_spec.rb +2 -2
  20. data/spec/controllers/extended_controller_spec.rb +2 -2
  21. data/spec/controllers/included_param_group_controller_spec.rb +1 -1
  22. data/spec/controllers/users_controller_spec.rb +64 -63
  23. data/spec/dummy/app/controllers/extending_concern.rb +7 -7
  24. data/spec/dummy/app/controllers/pets_controller.rb +4 -4
  25. data/spec/dummy/app/controllers/pets_using_auto_views_controller.rb +2 -2
  26. data/spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb +16 -16
  27. data/spec/dummy/app/controllers/sample_controller.rb +31 -31
  28. data/spec/lib/apipie/application_spec.rb +2 -2
  29. data/spec/lib/apipie/extractor/writer_spec.rb +8 -8
  30. data/spec/lib/apipie/method_description_spec.rb +2 -2
  31. data/spec/lib/apipie/param_description_spec.rb +47 -47
  32. data/spec/lib/apipie/param_group_spec.rb +4 -4
  33. data/spec/lib/apipie/resource_description_spec.rb +2 -2
  34. data/spec/lib/apipie/validator_spec.rb +12 -12
  35. data/spec/lib/swagger/swagger_dsl_spec.rb +40 -40
  36. data/spec/test_engine/memes_controller_spec.rb +1 -1
  37. metadata +138 -4
@@ -58,7 +58,7 @@ describe Apipie::MethodDescription do
58
58
  )
59
59
  end
60
60
 
61
- it 'should be ordered' do
61
+ it 'is ordered' do
62
62
  expect(json_params).to eq(%w[a b c])
63
63
  end
64
64
 
@@ -75,7 +75,7 @@ describe Apipie::MethodDescription do
75
75
  )
76
76
  end
77
77
 
78
- it 'should ignore response-only parameters' do
78
+ it 'ignores response-only parameters' do
79
79
  expect(json_params).to eq(%w[a c])
80
80
  end
81
81
  end
@@ -14,12 +14,12 @@ describe Apipie::ParamDescription do
14
14
 
15
15
  describe "metadata" do
16
16
 
17
- it "should return nil when no metadata is provided" do
17
+ it "returns nil when no metadata is provided" do
18
18
  param = Apipie::ParamDescription.new(method_desc, :some_param, String)
19
19
  expect(param.to_json[:metadata]).to eq(nil)
20
20
  end
21
21
 
22
- it "should return the metadata" do
22
+ it "returns the metadata" do
23
23
  meta = {
24
24
  :length => 32,
25
25
  :weight => '830g'
@@ -32,12 +32,12 @@ describe Apipie::ParamDescription do
32
32
 
33
33
  describe "show option" do
34
34
 
35
- it "should return true when show option is not provided" do
35
+ it "returns true when show option is not provided" do
36
36
  param = Apipie::ParamDescription.new(method_desc, :some_param, String)
37
37
  expect(param.to_json[:show]).to eq(true)
38
38
  end
39
39
 
40
- it "should return the show option" do
40
+ it "returns the show option" do
41
41
  param = Apipie::ParamDescription.new(method_desc, :some_param, String, :show => true)
42
42
  expect(param.to_json[:show]).to eq(true)
43
43
 
@@ -50,7 +50,7 @@ describe Apipie::ParamDescription do
50
50
  describe "full_name" do
51
51
  context "with no nested parameters" do
52
52
 
53
- it "should return name" do
53
+ it "returns name" do
54
54
  param = Apipie::ParamDescription.new(method_desc, :some_param, String)
55
55
  expect(param.to_json[:full_name]).to eq('some_param')
56
56
  end
@@ -59,7 +59,7 @@ describe Apipie::ParamDescription do
59
59
 
60
60
  context "with nested parameters" do
61
61
 
62
- it "should return the parameter's name nested in the parents name" do
62
+ it "returns the parameter's name nested in the parents name" do
63
63
  parent_param = Apipie::ParamDescription.new(method_desc, :parent, String)
64
64
  nested_param = Apipie::ParamDescription.new(method_desc, :nested, String, :parent => parent_param)
65
65
 
@@ -68,7 +68,7 @@ describe Apipie::ParamDescription do
68
68
 
69
69
  context "with the parent parameter set to not show" do
70
70
 
71
- it "should return just the parameter's name" do
71
+ it "returns just the parameter's name" do
72
72
  parent_param = Apipie::ParamDescription.new(method_desc, :parent, String, :show => false)
73
73
  nested_param = Apipie::ParamDescription.new(method_desc, :nested, String, :parent => parent_param)
74
74
 
@@ -80,13 +80,13 @@ describe Apipie::ParamDescription do
80
80
  end
81
81
 
82
82
  describe "manual validation text" do
83
- it "should allow manual text" do
83
+ it "allows manual text" do
84
84
  param = Apipie::ParamDescription.new(method_desc, :hidden_param, nil, :validations => "must be foo")
85
85
 
86
86
  expect(param.validations).to include("\n<p>must be foo</p>\n")
87
87
  end
88
88
 
89
- it "should allow multiple items" do
89
+ it "allows multiple items" do
90
90
  param = Apipie::ParamDescription.new(method_desc, :hidden_param, nil, :validations => ["> 0", "< 5"])
91
91
 
92
92
  expect(param.validations).to include("\n<p>&gt; 0</p>\n")
@@ -96,16 +96,16 @@ describe Apipie::ParamDescription do
96
96
 
97
97
  describe "validator selection" do
98
98
 
99
- it "should allow nil validator" do
99
+ it "allows nil validator" do
100
100
  param = Apipie::ParamDescription.new(method_desc, :hidden_param, nil)
101
101
  expect(param.validator).to be_nil
102
102
  end
103
103
 
104
- it "should throw exception on unknown validator" do
104
+ it "throws exception on unknown validator" do
105
105
  expect { Apipie::ParamDescription.new(method_desc, :param, :unknown) }.to raise_error(RuntimeError, /Validator.*not found/)
106
106
  end
107
107
 
108
- it "should pick type validator" do
108
+ it "picks type validator" do
109
109
  expect(Apipie::Validator::BaseValidator).to receive(:find).and_return(:validator_instance)
110
110
  param = Apipie::ParamDescription.new(method_desc, :param, String)
111
111
  expect(param.validator).to eq(:validator_instance)
@@ -137,7 +137,7 @@ describe Apipie::ParamDescription do
137
137
  context 'when validation value is false' do
138
138
  let(:validation_value) { false }
139
139
 
140
- it 'should not raise an error' do
140
+ it 'does not raise an error' do
141
141
  expect { subject }.not_to raise_error
142
142
  end
143
143
  end
@@ -145,7 +145,7 @@ describe Apipie::ParamDescription do
145
145
  context 'when validation value is an empty string' do
146
146
  let(:validation_value) { '' }
147
147
 
148
- it 'should raise an error' do
148
+ it 'raises an error' do
149
149
  expect { subject }.to raise_error(Apipie::ParamInvalid)
150
150
  end
151
151
  end
@@ -157,7 +157,7 @@ describe Apipie::ParamDescription do
157
157
  context 'when validation value is false' do
158
158
  let(:validation_value) { false }
159
159
 
160
- it 'should not raise an error' do
160
+ it 'does not raise an error' do
161
161
  expect { subject }.not_to raise_error
162
162
  end
163
163
  end
@@ -165,7 +165,7 @@ describe Apipie::ParamDescription do
165
165
  context 'when validation value is true' do
166
166
  let(:validation_value) { true }
167
167
 
168
- it 'should not raise an error' do
168
+ it 'does not raise an error' do
169
169
  expect { subject }.not_to raise_error
170
170
  end
171
171
  end
@@ -173,7 +173,7 @@ describe Apipie::ParamDescription do
173
173
  context 'when validation value is an empty string' do
174
174
  let(:validation_value) { '' }
175
175
 
176
- it 'should raise an error' do
176
+ it 'raises an error' do
177
177
  expect { subject }.to raise_error(Apipie::ParamInvalid)
178
178
  end
179
179
  end
@@ -185,14 +185,14 @@ describe Apipie::ParamDescription do
185
185
  context 'when validation value is empty string' do
186
186
  let(:validation_value) { '' }
187
187
 
188
- it 'should not raise an error' do
188
+ it 'does not raise an error' do
189
189
  expect { subject }.not_to raise_error
190
190
  end
191
191
 
192
192
  context 'when allow_blank is specified as true' do
193
193
  let(:allow_blank) { true }
194
194
 
195
- it 'should not raise an error' do
195
+ it 'does not raise an error' do
196
196
  expect { subject }.not_to raise_error
197
197
  end
198
198
  end
@@ -206,14 +206,14 @@ describe Apipie::ParamDescription do
206
206
  context 'when validation value' do
207
207
  let(:validation_value) { false }
208
208
 
209
- it 'should not raise an error' do
209
+ it 'does not raise an error' do
210
210
  expect { subject }.not_to raise_error
211
211
  end
212
212
 
213
213
  context 'when allow_blank is false' do
214
214
  let(:allow_blank) { false }
215
215
 
216
- it 'should not raise an error' do
216
+ it 'does not raise an error' do
217
217
  expect { subject }.not_to raise_error
218
218
  end
219
219
  end
@@ -221,7 +221,7 @@ describe Apipie::ParamDescription do
221
221
  context 'when allow_blank is true' do
222
222
  let(:allow_blank) { true }
223
223
 
224
- it 'should not raise an error' do
224
+ it 'does not raise an error' do
225
225
  expect { subject }.not_to raise_error
226
226
  end
227
227
  end
@@ -230,7 +230,7 @@ describe Apipie::ParamDescription do
230
230
  context 'when validation value is empty string' do
231
231
  let(:validation_value) { '' }
232
232
 
233
- it 'should raise an error' do
233
+ it 'raises an error' do
234
234
  expect { subject }.to raise_error(Apipie::ParamInvalid)
235
235
  end
236
236
  end
@@ -242,7 +242,7 @@ describe Apipie::ParamDescription do
242
242
  context 'when validation value is false' do
243
243
  let(:validation_value) { false }
244
244
 
245
- it 'should not raise an error' do
245
+ it 'does not raise an error' do
246
246
  expect { subject }.not_to raise_error
247
247
  end
248
248
  end
@@ -250,7 +250,7 @@ describe Apipie::ParamDescription do
250
250
  context 'when validation value is true' do
251
251
  let(:validation_value) { true }
252
252
 
253
- it 'should not raise an error' do
253
+ it 'does not raise an error' do
254
254
  expect { subject }.not_to raise_error
255
255
  end
256
256
  end
@@ -258,7 +258,7 @@ describe Apipie::ParamDescription do
258
258
  context 'when validation value is an empty string' do
259
259
  let(:validation_value) { '' }
260
260
 
261
- it 'should raise an error' do
261
+ it 'raises an error' do
262
262
  expect { subject }.to raise_error(Apipie::ParamInvalid)
263
263
  end
264
264
  end
@@ -275,14 +275,14 @@ describe Apipie::ParamDescription do
275
275
  context 'when a blank but valid value is passed' do
276
276
  let(:validation_value) { false }
277
277
 
278
- it 'should not raise an error' do
278
+ it 'does not raise an error' do
279
279
  expect { subject }.not_to raise_error
280
280
  end
281
281
 
282
282
  context 'when allow_blank is false' do
283
283
  let(:allow_blank) { false }
284
284
 
285
- it 'should not raise an error' do
285
+ it 'does not raise an error' do
286
286
  expect { subject }.not_to raise_error
287
287
  end
288
288
  end
@@ -291,7 +291,7 @@ describe Apipie::ParamDescription do
291
291
  context 'when a blank but invalid value is passed' do
292
292
  let(:validation_value) { '' }
293
293
 
294
- it 'should raise an error' do
294
+ it 'raises an error' do
295
295
  expect { subject }.to raise_error(Apipie::ParamInvalid)
296
296
  end
297
297
  end
@@ -304,7 +304,7 @@ describe Apipie::ParamDescription do
304
304
  context 'when a blank but invalid value is passed' do
305
305
  let(:validation_value) { '' }
306
306
 
307
- it 'should raise an error' do
307
+ it 'raises an error' do
308
308
  expect { subject }.to raise_error(Apipie::ParamInvalid)
309
309
  end
310
310
  end
@@ -315,7 +315,7 @@ describe Apipie::ParamDescription do
315
315
  context 'when and empty string is given' do
316
316
  let(:validation_value) { '' }
317
317
 
318
- it 'should not raise an error' do
318
+ it 'does not raise an error' do
319
319
  expect { subject }.not_to raise_error
320
320
  end
321
321
  end
@@ -335,27 +335,27 @@ describe Apipie::ParamDescription do
335
335
  Apipie::MethodDescription.new(:show, concern_resource_desc, concern_dsl_data)
336
336
  end
337
337
 
338
- it "should replace string parameter name with colon prefix" do
338
+ it "replaces string parameter name with colon prefix" do
339
339
  param = Apipie::ParamDescription.new(concern_method_desc, ":string_subst", String)
340
340
  expect(param.name).to eq("string")
341
341
  end
342
342
 
343
- it "should replace symbol parameter name" do
343
+ it "replaces symbol parameter name" do
344
344
  param = Apipie::ParamDescription.new(concern_method_desc, :concern, String)
345
345
  expect(param.name).to eq(:user)
346
346
  end
347
347
 
348
- it "should keep original value for strings without colon prefixes" do
348
+ it "keeps original value for strings without colon prefixes" do
349
349
  param = Apipie::ParamDescription.new(concern_method_desc, "string_subst", String)
350
350
  expect(param.name).to eq("string_subst")
351
351
  end
352
352
 
353
- it "should keep the original value when a string can't be replaced" do
353
+ it "keeps the original value when a string can't be replaced" do
354
354
  param = Apipie::ParamDescription.new(concern_method_desc, ":param", String)
355
355
  expect(param.name).to eq(":param")
356
356
  end
357
357
 
358
- it "should keep the original value when a symbol can't be replaced" do
358
+ it "keeps the original value when a symbol can't be replaced" do
359
359
  param = Apipie::ParamDescription.new(concern_method_desc, :param, String)
360
360
  expect(param.name).to eq(:param)
361
361
  end
@@ -366,12 +366,12 @@ describe Apipie::ParamDescription do
366
366
 
367
367
  before { Apipie.configuration.required_by_default = true }
368
368
 
369
- it "should set param as required by default" do
369
+ it "sets param as required by default" do
370
370
  param = Apipie::ParamDescription.new(method_desc, :required_by_default, String)
371
371
  expect(param.required).to be true
372
372
  end
373
373
 
374
- it "should be possible to set param as optional" do
374
+ it "is possible to set param as optional" do
375
375
  param = Apipie::ParamDescription.new(method_desc, :optional, String, :required => false)
376
376
  expect(param.required).to be false
377
377
  end
@@ -382,12 +382,12 @@ describe Apipie::ParamDescription do
382
382
 
383
383
  before { Apipie.configuration.required_by_default = false }
384
384
 
385
- it "should set param as optional by default" do
385
+ it "sets param as optional by default" do
386
386
  param = Apipie::ParamDescription.new(method_desc, :optional_by_default, String)
387
387
  expect(param.required).to be false
388
388
  end
389
389
 
390
- it "should be possible to set param as required" do
390
+ it "is possible to set param as required" do
391
391
  param = Apipie::ParamDescription.new(method_desc, :required, String, 'description','required' => true)
392
392
  expect(param.required).to be true
393
393
  end
@@ -402,21 +402,21 @@ describe Apipie::ParamDescription do
402
402
  end
403
403
 
404
404
  context "when the param is required for current action" do
405
- it "should set param as required" do
405
+ it "sets param as required" do
406
406
  param = Apipie::ParamDescription.new(method_desc, :required, String, 'description','required' => :create)
407
407
  expect(param.required).to be true
408
408
  end
409
409
  end
410
410
 
411
411
  context "when the param is required for multiple actions" do
412
- it "should set param as required if it match current action" do
412
+ it "sets param as required if it match current action" do
413
413
  param = Apipie::ParamDescription.new(method_desc, :required, String, 'description','required' => [:update, :create])
414
414
  expect(param.required).to be true
415
415
  end
416
416
  end
417
417
 
418
418
  context "when the param is not required for current action" do
419
- it "should set param as not required" do
419
+ it "sets param as not required" do
420
420
  param = Apipie::ParamDescription.new(method_desc, :required, String, 'description','required' => :update)
421
421
  expect(param.required).to be false
422
422
  end
@@ -500,7 +500,7 @@ describe Apipie::ParamDescription do
500
500
  end
501
501
  end
502
502
 
503
- it "should include the nested params in the json" do
503
+ it "includes the nested params in the json" do
504
504
  sub_params = subject.to_json[:params]
505
505
  expect(sub_params.size).to eq(1)
506
506
  sub_param = sub_params.first
@@ -518,7 +518,7 @@ describe Apipie::ParamDescription do
518
518
  end
519
519
  end
520
520
 
521
- it "should include the nested params in the json" do
521
+ it "includes the nested params in the json" do
522
522
  sub_params = subject.to_json[:params]
523
523
  expect(sub_params.size).to eq(1)
524
524
  sub_param = sub_params.first
@@ -534,7 +534,7 @@ describe Apipie::ParamDescription do
534
534
  Apipie::ParamDescription.new(method_desc, :param, String)
535
535
  end
536
536
 
537
- it "should include the nested params in the json" do
537
+ it "includes the nested params in the json" do
538
538
  expect(subject.to_json[:params]).to be_nil
539
539
  end
540
540
 
@@ -543,7 +543,7 @@ describe Apipie::ParamDescription do
543
543
  end
544
544
 
545
545
  describe "Array with classes" do
546
- it "should be valid for objects included in class array" do
546
+ it "is valid for objects included in class array" do
547
547
  param = Apipie::ParamDescription.new(method_desc, :param, [Integer, String])
548
548
  expect { param.validate("1") }.not_to raise_error
549
549
  expect { param.validate(Integer) }.to raise_error(Apipie::ParamInvalid)
@@ -20,7 +20,7 @@ describe "param groups" do
20
20
  expect(user_create_params.map(&:to_s).sort).to eq(%w[membership name pass])
21
21
  end
22
22
 
23
- it "should allow adding additional params to group" do
23
+ it "allows adding additional params to group" do
24
24
  user_create_desc = Apipie["users#create"].params[:user]
25
25
  user_create_params = user_create_desc.validator.params_ordered.map(&:name)
26
26
  expect(user_create_params.map(&:to_s).sort).to eq(%w[membership name pass permalink])
@@ -43,16 +43,16 @@ describe "param groups" do
43
43
  expect(arch_v1_params.sort_by(&:to_s)).to eq(arch_v2_params.sort_by(&:to_s))
44
44
  end
45
45
 
46
- it "should replace parameter name in a group when it comes from concern" do
46
+ it "replaces parameter name in a group when it comes from concern" do
47
47
  expect(Apipie["overridden_concern_resources#update"].params.key?(:user)).to eq(true)
48
48
  end
49
49
 
50
- it "shouldn't replace parameter name in a group redefined in the controller" do
50
+ it "does not replace parameter name in a group redefined in the controller" do
51
51
  expect(Apipie["overridden_concern_resources#create"].params.key?(:concern)).to eq(true)
52
52
  expect(Apipie["overridden_concern_resources#create"].params.key?(:user)).to eq(false)
53
53
  end
54
54
 
55
- it "shouldn't replace name of a parameter defined in the controller" do
55
+ it "does not replace name of a parameter defined in the controller" do
56
56
  expect(Apipie["overridden_concern_resources#custom"].params.key?(:concern)).to eq(true)
57
57
  expect(Apipie["overridden_concern_resources#custom"].params.key?(:user)).to eq(false)
58
58
  end
@@ -25,7 +25,7 @@ describe Apipie::ResourceDescription do
25
25
  )
26
26
  end
27
27
 
28
- it 'should be ordered' do
28
+ it 'is ordered' do
29
29
  expect(methods.keys).to eq([:a, :b, :c])
30
30
  end
31
31
  end
@@ -63,7 +63,7 @@ describe Apipie::ResourceDescription do
63
63
  )
64
64
  end
65
65
 
66
- it 'should be ordered' do
66
+ it 'is ordered' do
67
67
  expect(methods_as_json.map { |h| h[:name] }).to eq(%w[a b c])
68
68
  end
69
69
  end
@@ -20,22 +20,22 @@ describe Apipie::Validator do
20
20
 
21
21
  context "expected type" do
22
22
 
23
- it "should return hash for type Hash" do
23
+ it "returns hash for type Hash" do
24
24
  validator = Apipie::Validator::TypeValidator.new(params_desc, Hash)
25
25
  expect(validator.expected_type).to eq('hash')
26
26
  end
27
27
 
28
- it "should return array for type Array" do
28
+ it "returns array for type Array" do
29
29
  validator = Apipie::Validator::TypeValidator.new(params_desc, Array)
30
30
  expect(validator.expected_type).to eq('array')
31
31
  end
32
32
 
33
- it "should return numeric for type Numeric" do
33
+ it "returns numeric for type Numeric" do
34
34
  validator = Apipie::Validator::TypeValidator.new(params_desc, Numeric)
35
35
  expect(validator.expected_type).to eq('numeric')
36
36
  end
37
37
 
38
- it "should return string by default" do
38
+ it "returns string by default" do
39
39
  validator = Apipie::Validator::TypeValidator.new(params_desc, Symbol)
40
40
  expect(validator.expected_type).to eq('string')
41
41
  end
@@ -43,7 +43,7 @@ describe Apipie::Validator do
43
43
  end
44
44
 
45
45
  describe 'NumberValidator' do
46
- it 'should expect a Numeric type' do
46
+ it 'expects a Numeric type' do
47
47
  validator = Apipie::Validator::BaseValidator.find(params_desc, :number, nil, nil)
48
48
  expect(validator.expected_type).to eq('numeric')
49
49
  end
@@ -86,7 +86,7 @@ describe Apipie::Validator do
86
86
  end
87
87
 
88
88
  describe '#validate' do
89
- it "should validate by object class" do
89
+ it "validates by object class" do
90
90
  expect(validator_instance.validate("1")).to be_truthy
91
91
  expect(validator_instance.validate(1)).to be_truthy
92
92
  expect(validator_instance.validate(true)).to be_truthy
@@ -104,21 +104,21 @@ describe Apipie::Validator do
104
104
  end
105
105
 
106
106
  describe 'ArrayClassValidator' do
107
- it "should validate by object class" do
107
+ it "validates by object class" do
108
108
  validator = Apipie::Validator::ArrayClassValidator.new(params_desc, [Integer, String])
109
109
  expect(validator.validate("1")).to be_truthy
110
110
  expect(validator.validate(1)).to be_truthy
111
111
  expect(validator.validate({ 1 => 1 })).to be_falsey
112
112
  end
113
113
 
114
- it "should have a valid description" do
114
+ it "has a valid description" do
115
115
  validator = Apipie::Validator::ArrayClassValidator.new(params_desc, [Float, String])
116
116
  expect(validator.description).to eq('Must be one of: <code>Float</code>, <code>String</code>.')
117
117
  end
118
118
  end
119
119
 
120
120
  describe 'RegexpValidator' do
121
- it "should validate by object class" do
121
+ it "validates by object class" do
122
122
  validator = Apipie::Validator::RegexpValidator.new(params_desc, /^valid( extra)*$/)
123
123
  expect(validator.validate("valid")).to be_truthy
124
124
  expect(validator.validate("valid extra")).to be_truthy
@@ -126,14 +126,14 @@ describe Apipie::Validator do
126
126
  expect(validator.validate("invalid")).to be_falsey
127
127
  end
128
128
 
129
- it "should have a valid description" do
129
+ it "has a valid description" do
130
130
  validator = Apipie::Validator::RegexpValidator.new(params_desc, /^valid( extra)*$/)
131
131
  expect(validator.description).to eq('Must match regular expression <code>/^valid( extra)*$/</code>.')
132
132
  end
133
133
  end
134
134
 
135
135
  describe 'EnumValidator' do
136
- it "should validate by object class" do
136
+ it "validates by object class" do
137
137
  validator = Apipie::Validator::EnumValidator.new(params_desc, ['first', 'second & third'])
138
138
  expect(validator.validate("first")).to be_truthy
139
139
  expect(validator.validate("second & third")).to be_truthy
@@ -141,7 +141,7 @@ describe Apipie::Validator do
141
141
  expect(validator.validate({ 1 => 1 })).to be_falsey
142
142
  end
143
143
 
144
- it "should have a valid description" do
144
+ it "has a valid description" do
145
145
  validator = Apipie::Validator::EnumValidator.new(params_desc, ['first', 'second & third'])
146
146
  expect(validator.description).to eq('Must be one of: <code>first</code>, <code>second &amp; third</code>.')
147
147
  end