dry-validation 0.11.2 → 0.12.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile +7 -5
- data/README.md +4 -2
- data/Rakefile +5 -3
- data/benchmarks/benchmark_form_invalid.rb +2 -2
- data/benchmarks/benchmark_form_valid.rb +2 -2
- data/dry-validation.gemspec +2 -2
- data/examples/{form.rb → params.rb} +1 -1
- data/lib/dry/validation.rb +3 -3
- data/lib/dry/validation/{input_processor_compiler → compat}/form.rb +20 -2
- data/lib/dry/validation/extensions/monads.rb +6 -5
- data/lib/dry/validation/input_processor_compiler.rb +2 -1
- data/lib/dry/validation/input_processor_compiler/params.rb +49 -0
- data/lib/dry/validation/message_compiler.rb +4 -0
- data/lib/dry/validation/messages/abstract.rb +1 -1
- data/lib/dry/validation/predicate_registry.rb +12 -11
- data/lib/dry/validation/schema/class_interface.rb +7 -4
- data/lib/dry/validation/schema/form.rb +3 -15
- data/lib/dry/validation/schema/params.rb +22 -0
- data/lib/dry/validation/version.rb +1 -1
- data/spec/extensions/monads/result_spec.rb +15 -13
- data/spec/integration/messages/i18n_spec.rb +0 -2
- data/spec/integration/{form → params}/predicates/array_spec.rb +5 -5
- data/spec/integration/{form → params}/predicates/empty_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/eql_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/even_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/excluded_from_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/excludes_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/false_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/filled_spec.rb +10 -10
- data/spec/integration/{form → params}/predicates/format_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/gt_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/gteq_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/included_in_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/includes_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/key_spec.rb +5 -5
- data/spec/integration/{form → params}/predicates/lt_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/lteq_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/max_size_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/min_size_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/none_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/not_eql_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/odd_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/size/fixed_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/size/range_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/true_spec.rb +8 -8
- data/spec/integration/{form → params}/predicates/type_spec.rb +8 -8
- data/spec/integration/schema/array_schema_spec.rb +3 -3
- data/spec/integration/schema/extending_dsl_spec.rb +2 -2
- data/spec/integration/schema/form_spec.rb +3 -1
- data/spec/integration/schema/hash_schema_spec.rb +3 -3
- data/spec/integration/schema/json/explicit_types_spec.rb +1 -1
- data/spec/integration/schema/macros/each_spec.rb +1 -1
- data/spec/integration/schema/{form → params}/defining_base_schema_spec.rb +1 -1
- data/spec/integration/schema/{form → params}/explicit_types_spec.rb +35 -22
- data/spec/integration/schema/params_spec.rb +234 -0
- data/spec/integration/schema/reusing_schema_spec.rb +1 -1
- data/spec/integration/schema/using_types_spec.rb +1 -1
- data/spec/integration/schema_spec.rb +5 -5
- data/spec/spec_helper.rb +5 -2
- data/spec/unit/input_processor_compiler/{form_spec.rb → params_spec.rb} +13 -13
- metadata +77 -67
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'dry/validation/schema'
|
2
|
+
require 'dry/types/params'
|
3
|
+
|
4
|
+
module Dry
|
5
|
+
module Validation
|
6
|
+
class Schema::Params < Schema
|
7
|
+
def self.configure(klass = nil, &block)
|
8
|
+
if klass
|
9
|
+
klass.configure do |config|
|
10
|
+
config.input_processor = :params
|
11
|
+
config.hash_type = :symbolized
|
12
|
+
end
|
13
|
+
klass
|
14
|
+
else
|
15
|
+
super(&block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
configure(self)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -6,12 +6,13 @@ RSpec.describe Dry::Validation::Result do
|
|
6
6
|
context 'with valid input' do
|
7
7
|
let(:input) { { name: 'Jane' } }
|
8
8
|
|
9
|
-
describe '#
|
10
|
-
it 'returns a
|
11
|
-
|
9
|
+
describe '#to_monad' do
|
10
|
+
it 'returns a Success value' do
|
11
|
+
monad = result.to_monad
|
12
12
|
|
13
|
-
expect(
|
14
|
-
expect(
|
13
|
+
expect(monad).to be_a Dry::Monads::Result
|
14
|
+
expect(monad).to be_a_success
|
15
|
+
expect(monad.value!).to eql(name: 'Jane')
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -19,19 +20,20 @@ RSpec.describe Dry::Validation::Result do
|
|
19
20
|
context 'with invalid input' do
|
20
21
|
let(:input) { { name: '' } }
|
21
22
|
|
22
|
-
describe '#
|
23
|
-
it 'returns a
|
24
|
-
|
23
|
+
describe '#to_monad' do
|
24
|
+
it 'returns a Failure value' do
|
25
|
+
monad = result.to_monad
|
25
26
|
|
26
|
-
expect(
|
27
|
-
expect(
|
27
|
+
expect(monad).to be_a_failure
|
28
|
+
expect(monad.failure).to eql(name: ['must be filled', 'length must be within 2 - 4'])
|
28
29
|
end
|
29
30
|
|
30
31
|
it 'returns full messages' do
|
31
|
-
|
32
|
+
monad = result.to_monad(full: true)
|
32
33
|
|
33
|
-
expect(
|
34
|
-
expect(
|
34
|
+
expect(monad).to be_a Dry::Monads::Result
|
35
|
+
expect(monad).to be_a_failure
|
36
|
+
expect(monad.failure).to eql(name: ['name must be filled', 'name length must be within 2 - 4'])
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
@@ -80,8 +80,6 @@ RSpec.describe Messages::I18n do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'returns a message for a predicate in the default_locale' do
|
83
|
-
pending 'FIXME: this got broken for some reason, probably an I18n issue'
|
84
|
-
|
85
83
|
message = messages[:even?, rule: :some_number]
|
86
84
|
|
87
85
|
expect(I18n.locale).to eql(:pl)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
RSpec.describe 'Predicates: Array' do
|
2
2
|
context 'with required' do
|
3
3
|
subject(:schema) do
|
4
|
-
Dry::Validation.
|
4
|
+
Dry::Validation.Params do
|
5
5
|
required(:foo) { array? { each { int? } } }
|
6
6
|
end
|
7
7
|
end
|
@@ -73,7 +73,7 @@ RSpec.describe 'Predicates: Array' do
|
|
73
73
|
|
74
74
|
context 'with optional' do
|
75
75
|
subject(:schema) do
|
76
|
-
Dry::Validation.
|
76
|
+
Dry::Validation.Params do
|
77
77
|
optional(:foo) { array? { each { int? } } }
|
78
78
|
end
|
79
79
|
end
|
@@ -146,7 +146,7 @@ RSpec.describe 'Predicates: Array' do
|
|
146
146
|
context 'as macro' do
|
147
147
|
context 'with required' do
|
148
148
|
subject(:schema) do
|
149
|
-
Dry::Validation.
|
149
|
+
Dry::Validation.Params do
|
150
150
|
required(:foo).each(:int?)
|
151
151
|
end
|
152
152
|
end
|
@@ -194,7 +194,7 @@ RSpec.describe 'Predicates: Array' do
|
|
194
194
|
|
195
195
|
context 'with optional' do
|
196
196
|
subject(:schema) do
|
197
|
-
Dry::Validation.
|
197
|
+
Dry::Validation.Params do
|
198
198
|
optional(:foo).each(:int?)
|
199
199
|
end
|
200
200
|
end
|
@@ -242,7 +242,7 @@ RSpec.describe 'Predicates: Array' do
|
|
242
242
|
end
|
243
243
|
|
244
244
|
context 'with maybe macro' do
|
245
|
-
subject(:schema) { Dry::Validation.
|
245
|
+
subject(:schema) { Dry::Validation.Params { required(:foo).maybe(:array?) } }
|
246
246
|
|
247
247
|
context 'with empty string' do
|
248
248
|
let(:input) { { 'foo' => '' } }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
RSpec.describe 'Predicates: Empty' do
|
2
2
|
context 'with required' do
|
3
3
|
subject(:schema) do
|
4
|
-
Dry::Validation.
|
4
|
+
Dry::Validation.Params do
|
5
5
|
required(:foo) { empty? }
|
6
6
|
end
|
7
7
|
end
|
@@ -57,7 +57,7 @@ RSpec.describe 'Predicates: Empty' do
|
|
57
57
|
|
58
58
|
context 'with optional' do
|
59
59
|
subject(:schema) do
|
60
|
-
Dry::Validation.
|
60
|
+
Dry::Validation.Params do
|
61
61
|
optional(:foo) { empty? }
|
62
62
|
end
|
63
63
|
end
|
@@ -115,7 +115,7 @@ RSpec.describe 'Predicates: Empty' do
|
|
115
115
|
context 'with required' do
|
116
116
|
context 'with value' do
|
117
117
|
subject(:schema) do
|
118
|
-
Dry::Validation.
|
118
|
+
Dry::Validation.Params do
|
119
119
|
required(:foo).value(:empty?)
|
120
120
|
end
|
121
121
|
end
|
@@ -171,7 +171,7 @@ RSpec.describe 'Predicates: Empty' do
|
|
171
171
|
|
172
172
|
context 'with filled' do
|
173
173
|
it "raises error" do
|
174
|
-
expect { Dry::Validation.
|
174
|
+
expect { Dry::Validation.Params do
|
175
175
|
required(:foo).filled(:empty?)
|
176
176
|
end }.to raise_error InvalidSchemaError
|
177
177
|
end
|
@@ -179,7 +179,7 @@ RSpec.describe 'Predicates: Empty' do
|
|
179
179
|
|
180
180
|
context 'with maybe' do
|
181
181
|
it "raises error" do
|
182
|
-
expect { Dry::Validation.
|
182
|
+
expect { Dry::Validation.Params do
|
183
183
|
required(:foo).maybe(:empty?)
|
184
184
|
end }.to raise_error InvalidSchemaError
|
185
185
|
end
|
@@ -189,7 +189,7 @@ RSpec.describe 'Predicates: Empty' do
|
|
189
189
|
context 'with optional' do
|
190
190
|
context 'with value' do
|
191
191
|
subject(:schema) do
|
192
|
-
Dry::Validation.
|
192
|
+
Dry::Validation.Params do
|
193
193
|
optional(:foo).value(:empty?)
|
194
194
|
end
|
195
195
|
end
|
@@ -245,7 +245,7 @@ RSpec.describe 'Predicates: Empty' do
|
|
245
245
|
|
246
246
|
context 'with filled' do
|
247
247
|
it "raises error" do
|
248
|
-
expect { Dry::Validation.
|
248
|
+
expect { Dry::Validation.Params do
|
249
249
|
optional(:foo).filled(:empty?)
|
250
250
|
end }.to raise_error InvalidSchemaError
|
251
251
|
end
|
@@ -253,7 +253,7 @@ RSpec.describe 'Predicates: Empty' do
|
|
253
253
|
|
254
254
|
context 'with maybe' do
|
255
255
|
it "raises error" do
|
256
|
-
expect { Dry::Validation.
|
256
|
+
expect { Dry::Validation.Params do
|
257
257
|
optional(:foo).maybe(:empty?)
|
258
258
|
end }.to raise_error InvalidSchemaError
|
259
259
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
RSpec.describe 'Predicates: Eql' do
|
2
2
|
context 'with required' do
|
3
3
|
subject(:schema) do
|
4
|
-
Dry::Validation.
|
4
|
+
Dry::Validation.Params do
|
5
5
|
required(:foo) { eql?('23') }
|
6
6
|
end
|
7
7
|
end
|
@@ -41,7 +41,7 @@ RSpec.describe 'Predicates: Eql' do
|
|
41
41
|
|
42
42
|
context 'with optional' do
|
43
43
|
subject(:schema) do
|
44
|
-
Dry::Validation.
|
44
|
+
Dry::Validation.Params do
|
45
45
|
optional(:foo) { eql?('23') }
|
46
46
|
end
|
47
47
|
end
|
@@ -83,7 +83,7 @@ RSpec.describe 'Predicates: Eql' do
|
|
83
83
|
context 'with required' do
|
84
84
|
context 'with value' do
|
85
85
|
subject(:schema) do
|
86
|
-
Dry::Validation.
|
86
|
+
Dry::Validation.Params do
|
87
87
|
required(:foo).value(eql?: '23')
|
88
88
|
end
|
89
89
|
end
|
@@ -123,7 +123,7 @@ RSpec.describe 'Predicates: Eql' do
|
|
123
123
|
|
124
124
|
context 'with filled' do
|
125
125
|
subject(:schema) do
|
126
|
-
Dry::Validation.
|
126
|
+
Dry::Validation.Params do
|
127
127
|
required(:foo).filled(eql?: '23')
|
128
128
|
end
|
129
129
|
end
|
@@ -163,7 +163,7 @@ RSpec.describe 'Predicates: Eql' do
|
|
163
163
|
|
164
164
|
context 'with maybe' do
|
165
165
|
subject(:schema) do
|
166
|
-
Dry::Validation.
|
166
|
+
Dry::Validation.Params do
|
167
167
|
required(:foo).maybe(eql?: '23')
|
168
168
|
end
|
169
169
|
end
|
@@ -205,7 +205,7 @@ RSpec.describe 'Predicates: Eql' do
|
|
205
205
|
context 'with optional' do
|
206
206
|
context 'with value' do
|
207
207
|
subject(:schema) do
|
208
|
-
Dry::Validation.
|
208
|
+
Dry::Validation.Params do
|
209
209
|
optional(:foo).value(eql?: '23')
|
210
210
|
end
|
211
211
|
end
|
@@ -245,7 +245,7 @@ RSpec.describe 'Predicates: Eql' do
|
|
245
245
|
|
246
246
|
context 'with filled' do
|
247
247
|
subject(:schema) do
|
248
|
-
Dry::Validation.
|
248
|
+
Dry::Validation.Params do
|
249
249
|
optional(:foo).filled(eql?: '23')
|
250
250
|
end
|
251
251
|
end
|
@@ -285,7 +285,7 @@ RSpec.describe 'Predicates: Eql' do
|
|
285
285
|
|
286
286
|
context 'with maybe' do
|
287
287
|
subject(:schema) do
|
288
|
-
Dry::Validation.
|
288
|
+
Dry::Validation.Params do
|
289
289
|
optional(:foo).maybe(eql?: '23')
|
290
290
|
end
|
291
291
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
RSpec.describe 'Predicates: Even' do
|
2
2
|
context 'with required' do
|
3
3
|
subject(:schema) do
|
4
|
-
Dry::Validation.
|
4
|
+
Dry::Validation.Params do
|
5
5
|
required(:foo) { int? & even? }
|
6
6
|
end
|
7
7
|
end
|
@@ -57,7 +57,7 @@ RSpec.describe 'Predicates: Even' do
|
|
57
57
|
|
58
58
|
context 'with optional' do
|
59
59
|
subject(:schema) do
|
60
|
-
Dry::Validation.
|
60
|
+
Dry::Validation.Params do
|
61
61
|
optional(:foo) { int? & even? }
|
62
62
|
end
|
63
63
|
end
|
@@ -115,7 +115,7 @@ RSpec.describe 'Predicates: Even' do
|
|
115
115
|
context 'with required' do
|
116
116
|
context 'with value' do
|
117
117
|
subject(:schema) do
|
118
|
-
Dry::Validation.
|
118
|
+
Dry::Validation.Params do
|
119
119
|
required(:foo).value(:int?, :even?)
|
120
120
|
end
|
121
121
|
end
|
@@ -171,7 +171,7 @@ RSpec.describe 'Predicates: Even' do
|
|
171
171
|
|
172
172
|
context 'with filled' do
|
173
173
|
subject(:schema) do
|
174
|
-
Dry::Validation.
|
174
|
+
Dry::Validation.Params do
|
175
175
|
required(:foo).filled(:int?, :even?)
|
176
176
|
end
|
177
177
|
end
|
@@ -227,7 +227,7 @@ RSpec.describe 'Predicates: Even' do
|
|
227
227
|
|
228
228
|
context 'with maybe' do
|
229
229
|
subject(:schema) do
|
230
|
-
Dry::Validation.
|
230
|
+
Dry::Validation.Params do
|
231
231
|
required(:foo).maybe(:int?, :even?)
|
232
232
|
end
|
233
233
|
end
|
@@ -285,7 +285,7 @@ RSpec.describe 'Predicates: Even' do
|
|
285
285
|
context 'with optional' do
|
286
286
|
context 'with value' do
|
287
287
|
subject(:schema) do
|
288
|
-
Dry::Validation.
|
288
|
+
Dry::Validation.Params do
|
289
289
|
optional(:foo).value(:int?, :even?)
|
290
290
|
end
|
291
291
|
end
|
@@ -341,7 +341,7 @@ RSpec.describe 'Predicates: Even' do
|
|
341
341
|
|
342
342
|
context 'with filled' do
|
343
343
|
subject(:schema) do
|
344
|
-
Dry::Validation.
|
344
|
+
Dry::Validation.Params do
|
345
345
|
optional(:foo).filled(:int?, :even?)
|
346
346
|
end
|
347
347
|
end
|
@@ -397,7 +397,7 @@ RSpec.describe 'Predicates: Even' do
|
|
397
397
|
|
398
398
|
context 'with maybe' do
|
399
399
|
subject(:schema) do
|
400
|
-
Dry::Validation.
|
400
|
+
Dry::Validation.Params do
|
401
401
|
optional(:foo).maybe(:int?, :even?)
|
402
402
|
end
|
403
403
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
RSpec.describe 'Predicates: Excluded From' do
|
2
2
|
context 'with required' do
|
3
3
|
subject(:schema) do
|
4
|
-
Dry::Validation.
|
4
|
+
Dry::Validation.Params do
|
5
5
|
required(:foo) { excluded_from?(%w(1 3 5)) }
|
6
6
|
end
|
7
7
|
end
|
@@ -57,7 +57,7 @@ RSpec.describe 'Predicates: Excluded From' do
|
|
57
57
|
|
58
58
|
context 'with optional' do
|
59
59
|
subject(:schema) do
|
60
|
-
Dry::Validation.
|
60
|
+
Dry::Validation.Params do
|
61
61
|
optional(:foo) { excluded_from?(%w(1 3 5)) }
|
62
62
|
end
|
63
63
|
end
|
@@ -115,7 +115,7 @@ RSpec.describe 'Predicates: Excluded From' do
|
|
115
115
|
context 'with required' do
|
116
116
|
context 'with value' do
|
117
117
|
subject(:schema) do
|
118
|
-
Dry::Validation.
|
118
|
+
Dry::Validation.Params do
|
119
119
|
required(:foo).value(excluded_from?: %w(1 3 5))
|
120
120
|
end
|
121
121
|
end
|
@@ -171,7 +171,7 @@ RSpec.describe 'Predicates: Excluded From' do
|
|
171
171
|
|
172
172
|
context 'with filled' do
|
173
173
|
subject(:schema) do
|
174
|
-
Dry::Validation.
|
174
|
+
Dry::Validation.Params do
|
175
175
|
required(:foo).filled(excluded_from?: %w(1 3 5))
|
176
176
|
end
|
177
177
|
end
|
@@ -227,7 +227,7 @@ RSpec.describe 'Predicates: Excluded From' do
|
|
227
227
|
|
228
228
|
context 'with maybe' do
|
229
229
|
subject(:schema) do
|
230
|
-
Dry::Validation.
|
230
|
+
Dry::Validation.Params do
|
231
231
|
required(:foo).maybe(excluded_from?: %w(1 3 5))
|
232
232
|
end
|
233
233
|
end
|
@@ -285,7 +285,7 @@ RSpec.describe 'Predicates: Excluded From' do
|
|
285
285
|
context 'with optional' do
|
286
286
|
context 'with value' do
|
287
287
|
subject(:schema) do
|
288
|
-
Dry::Validation.
|
288
|
+
Dry::Validation.Params do
|
289
289
|
optional(:foo).value(excluded_from?: %w(1 3 5))
|
290
290
|
end
|
291
291
|
end
|
@@ -341,7 +341,7 @@ RSpec.describe 'Predicates: Excluded From' do
|
|
341
341
|
|
342
342
|
context 'with filled' do
|
343
343
|
subject(:schema) do
|
344
|
-
Dry::Validation.
|
344
|
+
Dry::Validation.Params do
|
345
345
|
optional(:foo).filled(excluded_from?: %w(1 3 5))
|
346
346
|
end
|
347
347
|
end
|
@@ -397,7 +397,7 @@ RSpec.describe 'Predicates: Excluded From' do
|
|
397
397
|
|
398
398
|
context 'with maybe' do
|
399
399
|
subject(:schema) do
|
400
|
-
Dry::Validation.
|
400
|
+
Dry::Validation.Params do
|
401
401
|
optional(:foo).maybe(excluded_from?: %w(1 3 5))
|
402
402
|
end
|
403
403
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
RSpec.describe 'Predicates: Excludes' do
|
2
2
|
context 'with required' do
|
3
3
|
subject(:schema) do
|
4
|
-
Dry::Validation.
|
4
|
+
Dry::Validation.Params do
|
5
5
|
required(:foo) { array? { each { int? } & excludes?(1) } }
|
6
6
|
end
|
7
7
|
end
|
@@ -49,7 +49,7 @@ RSpec.describe 'Predicates: Excludes' do
|
|
49
49
|
|
50
50
|
context 'with optional' do
|
51
51
|
subject(:schema) do
|
52
|
-
Dry::Validation.
|
52
|
+
Dry::Validation.Params do
|
53
53
|
optional(:foo) { array? { each { int? } & excludes?(1) } }
|
54
54
|
end
|
55
55
|
end
|
@@ -99,7 +99,7 @@ RSpec.describe 'Predicates: Excludes' do
|
|
99
99
|
context 'with required' do
|
100
100
|
context 'with value' do
|
101
101
|
subject(:schema) do
|
102
|
-
Dry::Validation.
|
102
|
+
Dry::Validation.Params do
|
103
103
|
required(:foo).value(excludes?: "foo")
|
104
104
|
end
|
105
105
|
end
|
@@ -147,7 +147,7 @@ RSpec.describe 'Predicates: Excludes' do
|
|
147
147
|
|
148
148
|
context 'with filled' do
|
149
149
|
subject(:schema) do
|
150
|
-
Dry::Validation.
|
150
|
+
Dry::Validation.Params do
|
151
151
|
required(:foo).filled(excludes?: 'foo')
|
152
152
|
end
|
153
153
|
end
|
@@ -195,7 +195,7 @@ RSpec.describe 'Predicates: Excludes' do
|
|
195
195
|
|
196
196
|
context 'with maybe' do
|
197
197
|
subject(:schema) do
|
198
|
-
Dry::Validation.
|
198
|
+
Dry::Validation.Params do
|
199
199
|
required(:foo).maybe(excludes?: 'foo')
|
200
200
|
end
|
201
201
|
end
|
@@ -245,7 +245,7 @@ RSpec.describe 'Predicates: Excludes' do
|
|
245
245
|
context 'with optional' do
|
246
246
|
context 'with value' do
|
247
247
|
subject(:schema) do
|
248
|
-
Dry::Validation.
|
248
|
+
Dry::Validation.Params do
|
249
249
|
optional(:foo).value(excludes?: '1')
|
250
250
|
end
|
251
251
|
end
|
@@ -293,7 +293,7 @@ RSpec.describe 'Predicates: Excludes' do
|
|
293
293
|
|
294
294
|
context 'with filled' do
|
295
295
|
subject(:schema) do
|
296
|
-
Dry::Validation.
|
296
|
+
Dry::Validation.Params do
|
297
297
|
optional(:foo).filled(excludes?: 'foo')
|
298
298
|
end
|
299
299
|
end
|
@@ -341,7 +341,7 @@ RSpec.describe 'Predicates: Excludes' do
|
|
341
341
|
|
342
342
|
context 'with maybe' do
|
343
343
|
subject(:schema) do
|
344
|
-
Dry::Validation.
|
344
|
+
Dry::Validation.Params do
|
345
345
|
optional(:foo).maybe(excludes?: 'foo')
|
346
346
|
end
|
347
347
|
end
|