dry-validation 0.10.5 → 0.10.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/lib/dry/validation/messages/namespaced.rb +4 -0
  4. data/lib/dry/validation/version.rb +1 -1
  5. data/spec/integration/custom_predicates_spec.rb +1 -1
  6. data/spec/integration/form/predicates/empty_spec.rb +4 -4
  7. data/spec/integration/form/predicates/filled_spec.rb +2 -2
  8. data/spec/integration/form/predicates/max_size_spec.rb +3 -3
  9. data/spec/integration/form/predicates/min_size_spec.rb +4 -4
  10. data/spec/integration/form/predicates/none_spec.rb +2 -2
  11. data/spec/integration/form/predicates/size/fixed_spec.rb +4 -4
  12. data/spec/integration/form/predicates/size/range_spec.rb +4 -4
  13. data/spec/integration/localized_error_messages_spec.rb +18 -0
  14. data/spec/integration/schema/predicates/empty_spec.rb +4 -4
  15. data/spec/integration/schema/predicates/filled_spec.rb +2 -2
  16. data/spec/integration/schema/predicates/gt_spec.rb +16 -16
  17. data/spec/integration/schema/predicates/gteq_spec.rb +16 -16
  18. data/spec/integration/schema/predicates/key_spec.rb +8 -8
  19. data/spec/integration/schema/predicates/lt_spec.rb +13 -13
  20. data/spec/integration/schema/predicates/lteq_spec.rb +13 -13
  21. data/spec/integration/schema/predicates/max_size_spec.rb +3 -3
  22. data/spec/integration/schema/predicates/min_size_spec.rb +4 -4
  23. data/spec/integration/schema/predicates/none_spec.rb +2 -2
  24. data/spec/integration/schema/predicates/size/fixed_spec.rb +4 -4
  25. data/spec/integration/schema/predicates/size/range_spec.rb +4 -4
  26. data/spec/integration/schema/predicates/type_spec.rb +2 -2
  27. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36e1f0888606fa21ee7c838c70cf467efac88716
4
- data.tar.gz: c3547d8a4c3829a4d40703c99ba4983f516b6061
3
+ metadata.gz: dd5d68508f5fa5b7d4b7331bb8093c473fe11823
4
+ data.tar.gz: ff357d71bd301ff4f2dc5d547ce6f8e7479598ae
5
5
  SHA512:
6
- metadata.gz: a6cd0689dac500264b7bb95bc6ab4945b9807abc345cf1d3883f8eb9cd0ee512a9555bbcc57e88ecc960ec7b103d8d04a1ae8f6e5f3f820aed7803c1ccf6655a
7
- data.tar.gz: 99e0d34b67ebd88827f2b262088c66d925d9aff1a23987e299bd9587dc7a0b87ecf89f0e182b8569d9b62c8ca64eb288a0171fbf95ac57a28625024ea4f8348a
6
+ metadata.gz: a1e29c2a839f6f268a80457fff0f769b34f388baccbbd589a6eb626b96604d62cedda0b5d1c21d4ffe77322e5ab9778a672cb3b42d2e6bcc5fbc113cf25fafee
7
+ data.tar.gz: 61f5cced9577c019354ae762c5a22596e1d1767f2384539adf8ce8647ce552cc5077363dc1b72ef95a59fd46abe72d2e16523d7e21443d88c01926ddfab70d8a
@@ -1,3 +1,11 @@
1
+ # v0.10.6 2017-04-26
2
+
3
+ ### Fixed
4
+
5
+ * Fixes issue with wrong localized error messages when namespaced messages are used (kbredemeier)
6
+
7
+ [Compare v0.10.5...v0.10.6](https://github.com/dryrb/dry-validation/compare/v0.10.5...v0.10.6)
8
+
1
9
  # v0.10.5 2017-01-12
2
10
 
3
11
  ### Fixed
@@ -22,6 +22,10 @@ module Dry
22
22
  def lookup_paths(tokens)
23
23
  super(tokens.merge(root: "#{root}.rules.#{namespace}")) + super
24
24
  end
25
+
26
+ def default_locale
27
+ messages.default_locale
28
+ end
25
29
  end
26
30
  end
27
31
  end
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Validation
3
- VERSION = '0.10.5'.freeze
3
+ VERSION = '0.10.6'.freeze
4
4
  end
5
5
  end
@@ -129,7 +129,7 @@ RSpec.describe Dry::Validation do
129
129
  )
130
130
  end
131
131
 
132
- it 'should work with custom predicate args' do
132
+ it 'works with custom predicate args' do
133
133
  schema = Dry::Validation.Schema do
134
134
  configure do
135
135
  def self.messages
@@ -170,7 +170,7 @@ RSpec.describe 'Predicates: Empty' do
170
170
  end
171
171
 
172
172
  context 'with filled' do
173
- it "should raise error" do
173
+ it "raises error" do
174
174
  expect { Dry::Validation.Form do
175
175
  required(:foo).filled(:empty?)
176
176
  end }.to raise_error InvalidSchemaError
@@ -178,7 +178,7 @@ RSpec.describe 'Predicates: Empty' do
178
178
  end
179
179
 
180
180
  context 'with maybe' do
181
- it "should raise error" do
181
+ it "raises error" do
182
182
  expect { Dry::Validation.Form do
183
183
  required(:foo).maybe(:empty?)
184
184
  end }.to raise_error InvalidSchemaError
@@ -244,7 +244,7 @@ RSpec.describe 'Predicates: Empty' do
244
244
  end
245
245
 
246
246
  context 'with filled' do
247
- it "should raise error" do
247
+ it "raises error" do
248
248
  expect { Dry::Validation.Form do
249
249
  optional(:foo).filled(:empty?)
250
250
  end }.to raise_error InvalidSchemaError
@@ -252,7 +252,7 @@ RSpec.describe 'Predicates: Empty' do
252
252
  end
253
253
 
254
254
  context 'with maybe' do
255
- it "should raise error" do
255
+ it "raises error" do
256
256
  expect { Dry::Validation.Form do
257
257
  optional(:foo).maybe(:empty?)
258
258
  end }.to raise_error InvalidSchemaError
@@ -170,7 +170,7 @@ RSpec.describe 'Predicates: Filled' do
170
170
  end
171
171
 
172
172
  context 'with filled' do
173
- it "should raise error" do
173
+ it "raises error" do
174
174
  expect { Dry::Validation.Form do
175
175
  required(:foo).filled(:filled?)
176
176
  end }.to raise_error InvalidSchemaError
@@ -346,7 +346,7 @@ RSpec.describe 'Predicates: Filled' do
346
346
  end
347
347
 
348
348
  context 'with filled' do
349
- it "should raise error" do
349
+ it "raises error" do
350
350
  expect { Dry::Validation.Form do
351
351
  optional(:foo).filled(:filled?)
352
352
  end }.to raise_error InvalidSchemaError
@@ -25,7 +25,7 @@ RSpec.describe 'Predicates: Max Size' do
25
25
  context 'with nil input' do
26
26
  let(:input) { { 'foo' => nil } }
27
27
 
28
- it 'is raises error' do
28
+ it 'raises error' do
29
29
  expect { result }.to raise_error(NoMethodError)
30
30
  end
31
31
  end
@@ -73,7 +73,7 @@ RSpec.describe 'Predicates: Max Size' do
73
73
  context 'with nil input' do
74
74
  let(:input) { { 'foo' => nil } }
75
75
 
76
- it 'is raises error' do
76
+ it 'raises error' do
77
77
  expect { result }.to raise_error(NoMethodError)
78
78
  end
79
79
  end
@@ -269,7 +269,7 @@ RSpec.describe 'Predicates: Max Size' do
269
269
  context 'with nil input' do
270
270
  let(:input) { { 'foo' => nil } }
271
271
 
272
- it 'is raises error' do
272
+ it 'raises error' do
273
273
  expect { result }.to raise_error(NoMethodError)
274
274
  end
275
275
  end
@@ -25,7 +25,7 @@ RSpec.describe 'Predicates: Min Size' do
25
25
  context 'with nil input' do
26
26
  let(:input) { { 'foo' => nil } }
27
27
 
28
- it 'is raises error' do
28
+ it 'raises error' do
29
29
  expect { result }.to raise_error(NoMethodError)
30
30
  end
31
31
  end
@@ -73,7 +73,7 @@ RSpec.describe 'Predicates: Min Size' do
73
73
  context 'with nil input' do
74
74
  let(:input) { { 'foo' => nil } }
75
75
 
76
- it 'is raises error' do
76
+ it 'raises error' do
77
77
  expect { result }.to raise_error(NoMethodError)
78
78
  end
79
79
  end
@@ -123,7 +123,7 @@ RSpec.describe 'Predicates: Min Size' do
123
123
  context 'with nil input' do
124
124
  let(:input) { { 'foo' => nil } }
125
125
 
126
- it 'is raises error' do
126
+ it 'raises error' do
127
127
  expect { result }.to raise_error(NoMethodError)
128
128
  end
129
129
  end
@@ -269,7 +269,7 @@ RSpec.describe 'Predicates: Min Size' do
269
269
  context 'with nil input' do
270
270
  let(:input) { { 'foo' => nil } }
271
271
 
272
- it 'is raises error' do
272
+ it 'raises error' do
273
273
  expect { result }.to raise_error(NoMethodError)
274
274
  end
275
275
  end
@@ -163,7 +163,7 @@ RSpec.describe 'Predicates: None' do
163
163
 
164
164
  #makes no sense see: #134
165
165
  context 'with maybe' do
166
- it "should raise error" do
166
+ it "raises error" do
167
167
  expect { Dry::Validation.Form do
168
168
  required(:foo).maybe(:none?)
169
169
  end }.to raise_error InvalidSchemaError
@@ -254,7 +254,7 @@ RSpec.describe 'Predicates: None' do
254
254
 
255
255
  #makes no sense see: #134
256
256
  context 'with maybe' do
257
- it "should raise error" do
257
+ it "raises error" do
258
258
  expect { Dry::Validation.Form do
259
259
  optional(:foo).maybe(:none?)
260
260
  end }.to raise_error InvalidSchemaError
@@ -26,7 +26,7 @@ RSpec.describe 'Predicates: Size' do
26
26
  context 'with nil input' do
27
27
  let(:input) { { 'foo' => nil } }
28
28
 
29
- it 'is raises error' do
29
+ it 'raises error' do
30
30
  expect { result }.to raise_error(NoMethodError)
31
31
  end
32
32
  end
@@ -74,7 +74,7 @@ RSpec.describe 'Predicates: Size' do
74
74
  context 'with nil input' do
75
75
  let(:input) { { 'foo' => nil } }
76
76
 
77
- it 'is raises error' do
77
+ it 'raises error' do
78
78
  expect { result }.to raise_error(NoMethodError)
79
79
  end
80
80
  end
@@ -124,7 +124,7 @@ RSpec.describe 'Predicates: Size' do
124
124
  context 'with nil input' do
125
125
  let(:input) { { 'foo' => nil } }
126
126
 
127
- it 'is raises error' do
127
+ it 'raises error' do
128
128
  expect { result }.to raise_error(NoMethodError)
129
129
  end
130
130
  end
@@ -270,7 +270,7 @@ RSpec.describe 'Predicates: Size' do
270
270
  context 'with nil input' do
271
271
  let(:input) { { 'foo' => nil } }
272
272
 
273
- it 'is raises error' do
273
+ it 'raises error' do
274
274
  expect { result }.to raise_error(NoMethodError)
275
275
  end
276
276
  end
@@ -26,7 +26,7 @@ RSpec.describe 'Predicates: Size' do
26
26
  context 'with nil input' do
27
27
  let(:input) { { 'foo' => nil } }
28
28
 
29
- it 'is raises error' do
29
+ it 'raises error' do
30
30
  expect { result }.to raise_error(NoMethodError)
31
31
  end
32
32
  end
@@ -75,7 +75,7 @@ RSpec.describe 'Predicates: Size' do
75
75
  context 'with nil input' do
76
76
  let(:input) { { 'foo' => nil } }
77
77
 
78
- it 'is raises error' do
78
+ it 'raises error' do
79
79
  expect { result }.to raise_error(NoMethodError)
80
80
  end
81
81
  end
@@ -126,7 +126,7 @@ RSpec.describe 'Predicates: Size' do
126
126
  context 'with nil input' do
127
127
  let(:input) { { 'foo' => nil } }
128
128
 
129
- it 'is raises error' do
129
+ it 'raises error' do
130
130
  expect { result }.to raise_error(NoMethodError)
131
131
  end
132
132
  end
@@ -272,7 +272,7 @@ RSpec.describe 'Predicates: Size' do
272
272
  context 'with nil input' do
273
273
  let(:input) { { 'foo' => nil } }
274
274
 
275
- it 'is raises error' do
275
+ it 'raises error' do
276
276
  expect { result }.to raise_error(NoMethodError)
277
277
  end
278
278
  end
@@ -49,6 +49,24 @@ RSpec.describe Dry::Validation, 'with localized messages' do
49
49
  )
50
50
  end
51
51
  end
52
+
53
+ describe '#errors' do
54
+ context 'with different locale' do
55
+ before do
56
+ I18n.locale = :pl
57
+ end
58
+
59
+ after do
60
+ I18n.locale = :en
61
+ end
62
+
63
+ it 'contains the localized errors' do
64
+ expect(schema.(email: '').errors).to eql(
65
+ { email: ['Hej user! Dawaj ten email no!'] }
66
+ )
67
+ end
68
+ end
69
+ end
52
70
  end
53
71
  end
54
72
  end
@@ -170,7 +170,7 @@ RSpec.describe 'Predicates: Empty' do
170
170
  end
171
171
 
172
172
  context 'with filled' do
173
- it "should raise error" do
173
+ it "raises error" do
174
174
  expect { Dry::Validation.Schema do
175
175
  required(:foo).filled(:empty?)
176
176
  end }.to raise_error InvalidSchemaError
@@ -178,7 +178,7 @@ RSpec.describe 'Predicates: Empty' do
178
178
  end
179
179
 
180
180
  context 'with maybe' do
181
- it "should raise error" do
181
+ it "raises error" do
182
182
  expect { Dry::Validation.Schema do
183
183
  required(:foo).maybe(:empty?)
184
184
  end }.to raise_error InvalidSchemaError
@@ -244,7 +244,7 @@ RSpec.describe 'Predicates: Empty' do
244
244
  end
245
245
 
246
246
  context 'with filled' do
247
- it "should raise error" do
247
+ it "raises error" do
248
248
  expect { Dry::Validation.Schema do
249
249
  optional(:foo).filled(:empty?)
250
250
  end }.to raise_error InvalidSchemaError
@@ -252,7 +252,7 @@ RSpec.describe 'Predicates: Empty' do
252
252
  end
253
253
 
254
254
  context 'with maybe' do
255
- it "should raise error" do
255
+ it "raises error" do
256
256
  expect { Dry::Validation.Schema do
257
257
  optional(:foo).maybe(:empty?)
258
258
  end }.to raise_error InvalidSchemaError
@@ -170,7 +170,7 @@ RSpec.describe 'Predicates: Filled' do
170
170
  end
171
171
 
172
172
  context 'with filled' do
173
- it "should raise error" do
173
+ it "raises error" do
174
174
  expect { Dry::Validation.Schema do
175
175
  required(:foo).filled(:filled?)
176
176
  end }.to raise_error InvalidSchemaError
@@ -346,7 +346,7 @@ RSpec.describe 'Predicates: Filled' do
346
346
  end
347
347
 
348
348
  context 'with filled' do
349
- it "should raise error" do
349
+ it "raises error" do
350
350
  expect { Dry::Validation.Schema do
351
351
  optional(:foo).filled(:filled?)
352
352
  end }.to raise_error InvalidSchemaError
@@ -25,7 +25,7 @@ RSpec.describe 'Predicates: Gt' do
25
25
  context 'with nil input' do
26
26
  let(:input) { { foo: nil } }
27
27
 
28
- it 'is raises error' do
28
+ it 'raises error' do
29
29
  expect { result }.to raise_error(NoMethodError)
30
30
  end
31
31
  end
@@ -33,7 +33,7 @@ RSpec.describe 'Predicates: Gt' do
33
33
  context 'with blank input' do
34
34
  let(:input) { { foo: '' } }
35
35
 
36
- it 'is raises error' do
36
+ it 'raises error' do
37
37
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
38
38
  end
39
39
  end
@@ -41,7 +41,7 @@ RSpec.describe 'Predicates: Gt' do
41
41
  context 'with invalid input type' do
42
42
  let(:input) { { foo: [] } }
43
43
 
44
- it 'is raises error' do
44
+ it 'raises error' do
45
45
  expect { result }.to raise_error(NoMethodError)
46
46
  end
47
47
  end
@@ -89,7 +89,7 @@ RSpec.describe 'Predicates: Gt' do
89
89
  context 'with nil input' do
90
90
  let(:input) { { foo: nil } }
91
91
 
92
- it 'is raises error' do
92
+ it 'raises error' do
93
93
  expect { result }.to raise_error(NoMethodError)
94
94
  end
95
95
  end
@@ -97,7 +97,7 @@ RSpec.describe 'Predicates: Gt' do
97
97
  context 'with blank input' do
98
98
  let(:input) { { foo: '' } }
99
99
 
100
- it 'is raises error' do
100
+ it 'raises error' do
101
101
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
102
102
  end
103
103
  end
@@ -105,7 +105,7 @@ RSpec.describe 'Predicates: Gt' do
105
105
  context 'with invalid input type' do
106
106
  let(:input) { { foo: [] } }
107
107
 
108
- it 'is raises error' do
108
+ it 'raises error' do
109
109
  expect { result }.to raise_error(NoMethodError)
110
110
  end
111
111
  end
@@ -155,7 +155,7 @@ RSpec.describe 'Predicates: Gt' do
155
155
  context 'with nil input' do
156
156
  let(:input) { { foo: nil } }
157
157
 
158
- it 'is raises error' do
158
+ it 'raises error' do
159
159
  expect { result }.to raise_error(NoMethodError)
160
160
  end
161
161
  end
@@ -163,7 +163,7 @@ RSpec.describe 'Predicates: Gt' do
163
163
  context 'with blank input' do
164
164
  let(:input) { { foo: '' } }
165
165
 
166
- it 'is raises error' do
166
+ it 'raises error' do
167
167
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
168
168
  end
169
169
  end
@@ -171,7 +171,7 @@ RSpec.describe 'Predicates: Gt' do
171
171
  context 'with invalid input type' do
172
172
  let(:input) { { foo: [] } }
173
173
 
174
- it 'is raises error' do
174
+ it 'raises error' do
175
175
  expect { result }.to raise_error(NoMethodError)
176
176
  end
177
177
  end
@@ -291,7 +291,7 @@ RSpec.describe 'Predicates: Gt' do
291
291
  context 'with blank input' do
292
292
  let(:input) { { foo: '' } }
293
293
 
294
- it 'is raises error' do
294
+ it 'raises error' do
295
295
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
296
296
  end
297
297
  end
@@ -299,7 +299,7 @@ RSpec.describe 'Predicates: Gt' do
299
299
  context 'with invalid input type' do
300
300
  let(:input) { { foo: [] } }
301
301
 
302
- it 'is raises error' do
302
+ it 'raises error' do
303
303
  expect { result }.to raise_error(NoMethodError)
304
304
  end
305
305
  end
@@ -349,7 +349,7 @@ RSpec.describe 'Predicates: Gt' do
349
349
  context 'with nil input' do
350
350
  let(:input) { { foo: nil } }
351
351
 
352
- it 'is raises error' do
352
+ it 'raises error' do
353
353
  expect { result }.to raise_error(NoMethodError)
354
354
  end
355
355
  end
@@ -357,7 +357,7 @@ RSpec.describe 'Predicates: Gt' do
357
357
  context 'with blank input' do
358
358
  let(:input) { { foo: '' } }
359
359
 
360
- it 'is raises error' do
360
+ it 'raises error' do
361
361
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
362
362
  end
363
363
  end
@@ -365,7 +365,7 @@ RSpec.describe 'Predicates: Gt' do
365
365
  context 'with invalid input type' do
366
366
  let(:input) { { foo: [] } }
367
367
 
368
- it 'is raises error' do
368
+ it 'raises error' do
369
369
  expect { result }.to raise_error(NoMethodError)
370
370
  end
371
371
  end
@@ -485,7 +485,7 @@ RSpec.describe 'Predicates: Gt' do
485
485
  context 'with blank input' do
486
486
  let(:input) { { foo: '' } }
487
487
 
488
- it 'is raises error' do
488
+ it 'raises error' do
489
489
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
490
490
  end
491
491
  end
@@ -493,7 +493,7 @@ RSpec.describe 'Predicates: Gt' do
493
493
  context 'with invalid input type' do
494
494
  let(:input) { { foo: [] } }
495
495
 
496
- it 'is raises error' do
496
+ it 'raises error' do
497
497
  expect { result }.to raise_error(NoMethodError)
498
498
  end
499
499
  end
@@ -25,7 +25,7 @@ RSpec.describe 'Predicates: Gteq' do
25
25
  context 'with nil input' do
26
26
  let(:input) { { foo: nil } }
27
27
 
28
- it 'is raises error' do
28
+ it 'raises error' do
29
29
  expect { result }.to raise_error(NoMethodError)
30
30
  end
31
31
  end
@@ -33,7 +33,7 @@ RSpec.describe 'Predicates: Gteq' do
33
33
  context 'with blank input' do
34
34
  let(:input) { { foo: '' } }
35
35
 
36
- it 'is raises error' do
36
+ it 'raises error' do
37
37
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
38
38
  end
39
39
  end
@@ -41,7 +41,7 @@ RSpec.describe 'Predicates: Gteq' do
41
41
  context 'with invalid input type' do
42
42
  let(:input) { { foo: [] } }
43
43
 
44
- it 'is raises error' do
44
+ it 'raises error' do
45
45
  expect { result }.to raise_error(NoMethodError)
46
46
  end
47
47
  end
@@ -89,7 +89,7 @@ RSpec.describe 'Predicates: Gteq' do
89
89
  context 'with nil input' do
90
90
  let(:input) { { foo: nil } }
91
91
 
92
- it 'is raises error' do
92
+ it 'raises error' do
93
93
  expect { result }.to raise_error(NoMethodError)
94
94
  end
95
95
  end
@@ -97,7 +97,7 @@ RSpec.describe 'Predicates: Gteq' do
97
97
  context 'with blank input' do
98
98
  let(:input) { { foo: '' } }
99
99
 
100
- it 'is raises error' do
100
+ it 'raises error' do
101
101
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
102
102
  end
103
103
  end
@@ -105,7 +105,7 @@ RSpec.describe 'Predicates: Gteq' do
105
105
  context 'with invalid input type' do
106
106
  let(:input) { { foo: [] } }
107
107
 
108
- it 'is raises error' do
108
+ it 'raises error' do
109
109
  expect { result }.to raise_error(NoMethodError)
110
110
  end
111
111
  end
@@ -155,7 +155,7 @@ RSpec.describe 'Predicates: Gteq' do
155
155
  context 'with nil input' do
156
156
  let(:input) { { foo: nil } }
157
157
 
158
- it 'is raises error' do
158
+ it 'raises error' do
159
159
  expect { result }.to raise_error(NoMethodError)
160
160
  end
161
161
  end
@@ -163,7 +163,7 @@ RSpec.describe 'Predicates: Gteq' do
163
163
  context 'with blank input' do
164
164
  let(:input) { { foo: '' } }
165
165
 
166
- it 'is raises error' do
166
+ it 'raises error' do
167
167
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
168
168
  end
169
169
  end
@@ -171,7 +171,7 @@ RSpec.describe 'Predicates: Gteq' do
171
171
  context 'with invalid input type' do
172
172
  let(:input) { { foo: [] } }
173
173
 
174
- it 'is raises error' do
174
+ it 'raises error' do
175
175
  expect { result }.to raise_error(NoMethodError)
176
176
  end
177
177
  end
@@ -291,7 +291,7 @@ RSpec.describe 'Predicates: Gteq' do
291
291
  context 'with blank input' do
292
292
  let(:input) { { foo: '' } }
293
293
 
294
- it 'is raises error' do
294
+ it 'raises error' do
295
295
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
296
296
  end
297
297
  end
@@ -299,7 +299,7 @@ RSpec.describe 'Predicates: Gteq' do
299
299
  context 'with invalid input type' do
300
300
  let(:input) { { foo: [] } }
301
301
 
302
- it 'is raises error' do
302
+ it 'raises error' do
303
303
  expect { result }.to raise_error(NoMethodError)
304
304
  end
305
305
  end
@@ -349,7 +349,7 @@ RSpec.describe 'Predicates: Gteq' do
349
349
  context 'with nil input' do
350
350
  let(:input) { { foo: nil } }
351
351
 
352
- it 'is raises error' do
352
+ it 'raises error' do
353
353
  expect { result }.to raise_error(NoMethodError)
354
354
  end
355
355
  end
@@ -357,7 +357,7 @@ RSpec.describe 'Predicates: Gteq' do
357
357
  context 'with blank input' do
358
358
  let(:input) { { foo: '' } }
359
359
 
360
- it 'is raises error' do
360
+ it 'raises error' do
361
361
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
362
362
  end
363
363
  end
@@ -365,7 +365,7 @@ RSpec.describe 'Predicates: Gteq' do
365
365
  context 'with invalid input type' do
366
366
  let(:input) { { foo: [] } }
367
367
 
368
- it 'is raises error' do
368
+ it 'raises error' do
369
369
  expect { result }.to raise_error(NoMethodError)
370
370
  end
371
371
  end
@@ -485,7 +485,7 @@ RSpec.describe 'Predicates: Gteq' do
485
485
  context 'with blank input' do
486
486
  let(:input) { { foo: '' } }
487
487
 
488
- it 'is raises error' do
488
+ it 'raises error' do
489
489
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
490
490
  end
491
491
  end
@@ -493,7 +493,7 @@ RSpec.describe 'Predicates: Gteq' do
493
493
  context 'with invalid input type' do
494
494
  let(:input) { { foo: [] } }
495
495
 
496
- it 'is raises error' do
496
+ it 'raises error' do
497
497
  expect { result }.to raise_error(NoMethodError)
498
498
  end
499
499
  end
@@ -15,7 +15,7 @@ RSpec.describe 'Predicates: Key' do
15
15
  end
16
16
 
17
17
  context 'with required' do
18
- it "should raise error" do
18
+ it "raises error" do
19
19
  expect { Dry::Validation.Schema do
20
20
  required(:foo) { key? }
21
21
  end }.to raise_error InvalidSchemaError
@@ -24,7 +24,7 @@ RSpec.describe 'Predicates: Key' do
24
24
 
25
25
  context 'with optional' do
26
26
  subject(:schema) do
27
- it "should raise error" do
27
+ it "raises error" do
28
28
  expect { Dry::Validation.Schema do
29
29
  optional(:foo) { key? }
30
30
  end }.to raise_error InvalidSchemaError
@@ -35,7 +35,7 @@ RSpec.describe 'Predicates: Key' do
35
35
  context 'as macro' do
36
36
  context 'with required' do
37
37
  context 'with value' do
38
- it "should raise error" do
38
+ it "raises error" do
39
39
  expect { Dry::Validation.Schema do
40
40
  required(:foo).value(:key?)
41
41
  end }.to raise_error InvalidSchemaError
@@ -43,7 +43,7 @@ RSpec.describe 'Predicates: Key' do
43
43
  end
44
44
 
45
45
  context 'with filled' do
46
- it "should raise error" do
46
+ it "raises error" do
47
47
  expect { Dry::Validation.Schema do
48
48
  required(:foo).filled(:key?)
49
49
  end }.to raise_error InvalidSchemaError
@@ -51,7 +51,7 @@ RSpec.describe 'Predicates: Key' do
51
51
  end
52
52
 
53
53
  context 'with maybe' do
54
- it "should raise error" do
54
+ it "raises error" do
55
55
  expect { Dry::Validation.Schema do
56
56
  required(:foo).maybe(:key?)
57
57
  end }.to raise_error InvalidSchemaError
@@ -61,7 +61,7 @@ RSpec.describe 'Predicates: Key' do
61
61
 
62
62
  context 'with optional' do
63
63
  context 'with value' do
64
- it "should raise error" do
64
+ it "raises error" do
65
65
  expect { Dry::Validation.Schema do
66
66
  optional(:foo).value(:key?)
67
67
  end }.to raise_error InvalidSchemaError
@@ -69,7 +69,7 @@ RSpec.describe 'Predicates: Key' do
69
69
  end
70
70
 
71
71
  context 'with filled' do
72
- it "should raise error" do
72
+ it "raises error" do
73
73
  expect { Dry::Validation.Schema do
74
74
  optional(:foo).filled(:key?)
75
75
  end }.to raise_error InvalidSchemaError
@@ -77,7 +77,7 @@ RSpec.describe 'Predicates: Key' do
77
77
  end
78
78
 
79
79
  context 'with maybe' do
80
- it "should raise error" do
80
+ it "raises error" do
81
81
  expect { Dry::Validation.Schema do
82
82
  optional(:foo).maybe(:key?)
83
83
  end }.to raise_error InvalidSchemaError
@@ -26,7 +26,7 @@ RSpec.describe 'Predicates: Lt' do
26
26
  context 'with nil input' do
27
27
  let(:input) { { foo: nil } }
28
28
 
29
- it 'is raises error' do
29
+ it 'raises error' do
30
30
  expect { result }.to raise_error(NoMethodError)
31
31
  end
32
32
  end
@@ -34,7 +34,7 @@ RSpec.describe 'Predicates: Lt' do
34
34
  context 'with blank input' do
35
35
  let(:input) { { foo: '' } }
36
36
 
37
- it 'is raises error' do
37
+ it 'raises error' do
38
38
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
39
39
  end
40
40
  end
@@ -42,7 +42,7 @@ RSpec.describe 'Predicates: Lt' do
42
42
  context 'with invalid input type' do
43
43
  let(:input) { { foo: [] } }
44
44
 
45
- it 'is raises error' do
45
+ it 'raises error' do
46
46
  expect { result }.to raise_error(NoMethodError)
47
47
  end
48
48
  end
@@ -90,7 +90,7 @@ RSpec.describe 'Predicates: Lt' do
90
90
  context 'with nil input' do
91
91
  let(:input) { { foo: nil } }
92
92
 
93
- it 'is raises error' do
93
+ it 'raises error' do
94
94
  expect { result }.to raise_error(NoMethodError)
95
95
  end
96
96
  end
@@ -98,7 +98,7 @@ RSpec.describe 'Predicates: Lt' do
98
98
  context 'with blank input' do
99
99
  let(:input) { { foo: '' } }
100
100
 
101
- it 'is raises error' do
101
+ it 'raises error' do
102
102
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
103
103
  end
104
104
  end
@@ -106,7 +106,7 @@ RSpec.describe 'Predicates: Lt' do
106
106
  context 'with invalid input type' do
107
107
  let(:input) { { foo: [] } }
108
108
 
109
- it 'is raises error' do
109
+ it 'raises error' do
110
110
  expect { result }.to raise_error(NoMethodError)
111
111
  end
112
112
  end
@@ -156,7 +156,7 @@ RSpec.describe 'Predicates: Lt' do
156
156
  context 'with nil input' do
157
157
  let(:input) { { foo: nil } }
158
158
 
159
- it 'is raises error' do
159
+ it 'raises error' do
160
160
  expect { result }.to raise_error(NoMethodError)
161
161
  end
162
162
  end
@@ -164,7 +164,7 @@ RSpec.describe 'Predicates: Lt' do
164
164
  context 'with blank input' do
165
165
  let(:input) { { foo: '' } }
166
166
 
167
- it 'is raises error' do
167
+ it 'raises error' do
168
168
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
169
169
  end
170
170
  end
@@ -172,7 +172,7 @@ RSpec.describe 'Predicates: Lt' do
172
172
  context 'with invalid input type' do
173
173
  let(:input) { { foo: [] } }
174
174
 
175
- it 'is raises error' do
175
+ it 'raises error' do
176
176
  expect { result }.to raise_error(NoMethodError)
177
177
  end
178
178
  end
@@ -292,7 +292,7 @@ RSpec.describe 'Predicates: Lt' do
292
292
  context 'with blank input' do
293
293
  let(:input) { { foo: '' } }
294
294
 
295
- it 'is raises error' do
295
+ it 'raises error' do
296
296
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
297
297
  end
298
298
  end
@@ -300,7 +300,7 @@ RSpec.describe 'Predicates: Lt' do
300
300
  context 'with invalid input type' do
301
301
  let(:input) { { foo: [] } }
302
302
 
303
- it 'is raises error' do
303
+ it 'raises error' do
304
304
  expect { result }.to raise_error(NoMethodError)
305
305
  end
306
306
  end
@@ -486,7 +486,7 @@ RSpec.describe 'Predicates: Lt' do
486
486
  context 'with blank input' do
487
487
  let(:input) { { foo: '' } }
488
488
 
489
- it 'is raises error' do
489
+ it 'raises error' do
490
490
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
491
491
  end
492
492
  end
@@ -494,7 +494,7 @@ RSpec.describe 'Predicates: Lt' do
494
494
  context 'with invalid input type' do
495
495
  let(:input) { { foo: [] } }
496
496
 
497
- it 'is raises error' do
497
+ it 'raises error' do
498
498
  expect { result }.to raise_error(NoMethodError)
499
499
  end
500
500
  end
@@ -25,7 +25,7 @@ RSpec.describe 'Predicates: Lteq' do
25
25
  context 'with nil input' do
26
26
  let(:input) { { foo: nil } }
27
27
 
28
- it 'is raises error' do
28
+ it 'raises error' do
29
29
  expect { result }.to raise_error(NoMethodError)
30
30
  end
31
31
  end
@@ -33,7 +33,7 @@ RSpec.describe 'Predicates: Lteq' do
33
33
  context 'with blank input' do
34
34
  let(:input) { { foo: '' } }
35
35
 
36
- it 'is raises error' do
36
+ it 'raises error' do
37
37
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
38
38
  end
39
39
  end
@@ -41,7 +41,7 @@ RSpec.describe 'Predicates: Lteq' do
41
41
  context 'with invalid input type' do
42
42
  let(:input) { { foo: [] } }
43
43
 
44
- it 'is raises error' do
44
+ it 'raises error' do
45
45
  expect { result }.to raise_error(NoMethodError)
46
46
  end
47
47
  end
@@ -89,7 +89,7 @@ RSpec.describe 'Predicates: Lteq' do
89
89
  context 'with nil input' do
90
90
  let(:input) { { foo: nil } }
91
91
 
92
- it 'is raises error' do
92
+ it 'raises error' do
93
93
  expect { result }.to raise_error(NoMethodError)
94
94
  end
95
95
  end
@@ -97,7 +97,7 @@ RSpec.describe 'Predicates: Lteq' do
97
97
  context 'with blank input' do
98
98
  let(:input) { { foo: '' } }
99
99
 
100
- it 'is raises error' do
100
+ it 'raises error' do
101
101
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
102
102
  end
103
103
  end
@@ -105,7 +105,7 @@ RSpec.describe 'Predicates: Lteq' do
105
105
  context 'with invalid input type' do
106
106
  let(:input) { { foo: [] } }
107
107
 
108
- it 'is raises error' do
108
+ it 'raises error' do
109
109
  expect { result }.to raise_error(NoMethodError)
110
110
  end
111
111
  end
@@ -155,7 +155,7 @@ RSpec.describe 'Predicates: Lteq' do
155
155
  context 'with nil input' do
156
156
  let(:input) { { foo: nil } }
157
157
 
158
- it 'is raises error' do
158
+ it 'raises error' do
159
159
  expect { result }.to raise_error(NoMethodError)
160
160
  end
161
161
  end
@@ -163,7 +163,7 @@ RSpec.describe 'Predicates: Lteq' do
163
163
  context 'with blank input' do
164
164
  let(:input) { { foo: '' } }
165
165
 
166
- it 'is raises error' do
166
+ it 'raises error' do
167
167
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
168
168
  end
169
169
  end
@@ -171,7 +171,7 @@ RSpec.describe 'Predicates: Lteq' do
171
171
  context 'with invalid input type' do
172
172
  let(:input) { { foo: [] } }
173
173
 
174
- it 'is raises error' do
174
+ it 'raises error' do
175
175
  expect { result }.to raise_error(NoMethodError)
176
176
  end
177
177
  end
@@ -291,7 +291,7 @@ RSpec.describe 'Predicates: Lteq' do
291
291
  context 'with blank input' do
292
292
  let(:input) { { foo: '' } }
293
293
 
294
- it 'is raises error' do
294
+ it 'raises error' do
295
295
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
296
296
  end
297
297
  end
@@ -299,7 +299,7 @@ RSpec.describe 'Predicates: Lteq' do
299
299
  context 'with invalid input type' do
300
300
  let(:input) { { foo: [] } }
301
301
 
302
- it 'is raises error' do
302
+ it 'raises error' do
303
303
  expect { result }.to raise_error(NoMethodError)
304
304
  end
305
305
  end
@@ -485,7 +485,7 @@ RSpec.describe 'Predicates: Lteq' do
485
485
  context 'with blank input' do
486
486
  let(:input) { { foo: '' } }
487
487
 
488
- it 'is raises error' do
488
+ it 'raises error' do
489
489
  expect { result }.to raise_error(ArgumentError, 'comparison of String with 23 failed')
490
490
  end
491
491
  end
@@ -493,7 +493,7 @@ RSpec.describe 'Predicates: Lteq' do
493
493
  context 'with invalid input type' do
494
494
  let(:input) { { foo: [] } }
495
495
 
496
- it 'is raises error' do
496
+ it 'raises error' do
497
497
  expect { result }.to raise_error(NoMethodError)
498
498
  end
499
499
  end
@@ -25,7 +25,7 @@ RSpec.describe 'Predicates: Max Size' do
25
25
  context 'with nil input' do
26
26
  let(:input) { { foo: nil } }
27
27
 
28
- it 'is raises error' do
28
+ it 'raises error' do
29
29
  expect { result }.to raise_error(NoMethodError)
30
30
  end
31
31
  end
@@ -73,7 +73,7 @@ RSpec.describe 'Predicates: Max Size' do
73
73
  context 'with nil input' do
74
74
  let(:input) { { foo: nil } }
75
75
 
76
- it 'is raises error' do
76
+ it 'raises error' do
77
77
  expect { result }.to raise_error(NoMethodError)
78
78
  end
79
79
  end
@@ -269,7 +269,7 @@ RSpec.describe 'Predicates: Max Size' do
269
269
  context 'with nil input' do
270
270
  let(:input) { { foo: nil } }
271
271
 
272
- it 'is raises error' do
272
+ it 'raises error' do
273
273
  expect { result }.to raise_error(NoMethodError)
274
274
  end
275
275
  end
@@ -25,7 +25,7 @@ RSpec.describe 'Predicates: Min Size' do
25
25
  context 'with nil input' do
26
26
  let(:input) { { foo: nil } }
27
27
 
28
- it 'is raises error' do
28
+ it 'raises error' do
29
29
  expect { result }.to raise_error(NoMethodError)
30
30
  end
31
31
  end
@@ -73,7 +73,7 @@ RSpec.describe 'Predicates: Min Size' do
73
73
  context 'with nil input' do
74
74
  let(:input) { { foo: nil } }
75
75
 
76
- it 'is raises error' do
76
+ it 'raises error' do
77
77
  expect { result }.to raise_error(NoMethodError)
78
78
  end
79
79
  end
@@ -123,7 +123,7 @@ RSpec.describe 'Predicates: Min Size' do
123
123
  context 'with nil input' do
124
124
  let(:input) { { foo: nil } }
125
125
 
126
- it 'is raises error' do
126
+ it 'raises error' do
127
127
  expect { result }.to raise_error(NoMethodError)
128
128
  end
129
129
  end
@@ -269,7 +269,7 @@ RSpec.describe 'Predicates: Min Size' do
269
269
  context 'with nil input' do
270
270
  let(:input) { { foo: nil } }
271
271
 
272
- it 'is raises error' do
272
+ it 'raises error' do
273
273
  expect { result }.to raise_error(NoMethodError)
274
274
  end
275
275
  end
@@ -163,7 +163,7 @@ RSpec.describe 'Predicates: None' do
163
163
 
164
164
  #makes no sense see: #134
165
165
  context 'with maybe' do
166
- it "should raise error" do
166
+ it "raises error" do
167
167
  expect { Dry::Validation.Schema do
168
168
  required(:foo).maybe(:none?)
169
169
  end }.to raise_error InvalidSchemaError
@@ -254,7 +254,7 @@ RSpec.describe 'Predicates: None' do
254
254
 
255
255
  #makes no sense see: #134
256
256
  context 'with maybe' do
257
- it "should raise error" do
257
+ it "raises error" do
258
258
  expect { Dry::Validation.Schema do
259
259
  optional(:foo).maybe(:none?)
260
260
  end }.to raise_error InvalidSchemaError
@@ -26,7 +26,7 @@ RSpec.describe 'Predicates: Size' do
26
26
  context 'with nil input' do
27
27
  let(:input) { { foo: nil } }
28
28
 
29
- it 'is raises error' do
29
+ it 'raises error' do
30
30
  expect { result }.to raise_error(NoMethodError)
31
31
  end
32
32
  end
@@ -74,7 +74,7 @@ RSpec.describe 'Predicates: Size' do
74
74
  context 'with nil input' do
75
75
  let(:input) { { foo: nil } }
76
76
 
77
- it 'is raises error' do
77
+ it 'raises error' do
78
78
  expect { result }.to raise_error(NoMethodError)
79
79
  end
80
80
  end
@@ -125,7 +125,7 @@ RSpec.describe 'Predicates: Size' do
125
125
  context 'with nil input' do
126
126
  let(:input) { { foo: nil } }
127
127
 
128
- it 'is raises error' do
128
+ it 'raises error' do
129
129
  expect { result }.to raise_error(NoMethodError)
130
130
  end
131
131
  end
@@ -273,7 +273,7 @@ RSpec.describe 'Predicates: Size' do
273
273
  context 'with nil input' do
274
274
  let(:input) { { foo: nil } }
275
275
 
276
- it 'is raises error' do
276
+ it 'raises error' do
277
277
  expect { result }.to raise_error(NoMethodError)
278
278
  end
279
279
  end
@@ -26,7 +26,7 @@ RSpec.describe 'Predicates: Size' do
26
26
  context 'with nil input' do
27
27
  let(:input) { { foo: nil } }
28
28
 
29
- it 'is raises error' do
29
+ it 'raises error' do
30
30
  expect { result }.to raise_error(NoMethodError)
31
31
  end
32
32
  end
@@ -74,7 +74,7 @@ RSpec.describe 'Predicates: Size' do
74
74
  context 'with nil input' do
75
75
  let(:input) { { foo: nil } }
76
76
 
77
- it 'is raises error' do
77
+ it 'raises error' do
78
78
  expect { result }.to raise_error(NoMethodError)
79
79
  end
80
80
  end
@@ -124,7 +124,7 @@ RSpec.describe 'Predicates: Size' do
124
124
  context 'with nil input' do
125
125
  let(:input) { { foo: nil } }
126
126
 
127
- it 'is raises error' do
127
+ it 'raises error' do
128
128
  expect { result }.to raise_error(NoMethodError)
129
129
  end
130
130
  end
@@ -270,7 +270,7 @@ RSpec.describe 'Predicates: Size' do
270
270
  context 'with nil input' do
271
271
  let(:input) { { foo: nil } }
272
272
 
273
- it 'is raises error' do
273
+ it 'raises error' do
274
274
  expect { result }.to raise_error(NoMethodError)
275
275
  end
276
276
  end
@@ -402,11 +402,11 @@ RSpec.describe 'Predicates: Type' do
402
402
  Object.send(:remove_const, :CustomClass)
403
403
  end
404
404
 
405
- it 'it succeeds with valid input' do
405
+ it 'succeeds with valid input' do
406
406
  expect(schema.(foo: CustomClass.new)).to be_success
407
407
  end
408
408
 
409
- it 'it fails with invalid input' do
409
+ it 'fails with invalid input' do
410
410
  expect(schema.(foo: 'oops')).to be_failing ["must be #{CustomClass}"]
411
411
  end
412
412
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.5
4
+ version: 0.10.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Holland
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-12 00:00:00.000000000 Z
12
+ date: 2017-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -372,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
372
372
  version: '0'
373
373
  requirements: []
374
374
  rubyforge_project:
375
- rubygems_version: 2.5.1
375
+ rubygems_version: 2.6.11
376
376
  signing_key:
377
377
  specification_version: 4
378
378
  summary: A simple validation library