rasti-form 3.1.1 → 3.1.2
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/lib/rasti/form/errors.rb +0 -2
- data/lib/rasti/form/version.rb +1 -1
- data/spec/form_spec.rb +14 -14
- data/spec/types/array_spec.rb +1 -1
- data/spec/types/form_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d63a6c2410b6e7bbb259a0212442d2aad83fa53c4191856baf04466d3e9c73d0
|
4
|
+
data.tar.gz: 1605263448bb732f3095b5fba45829ece27cecf159c2dbe39d1729dc3dc7981d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5df6a4b5dc7e8b1181a72ef0a1c9ba51b13b643c25c5cb6b8fef47369b181ee0c3598da1d4a22884dee6b5d4b9515f5638a52ae7a15b7cb9dd6c91c92863a76
|
7
|
+
data.tar.gz: da10879fdf48628f72e4d353ee22b628e7520c2e2201918712c63401bb81cd6a1550916f2d1c93bf68249b03ed98c938266842713c32f9bc3d380b7f3e8834fa
|
data/lib/rasti/form/errors.rb
CHANGED
data/lib/rasti/form/version.rb
CHANGED
data/spec/form_spec.rb
CHANGED
@@ -40,7 +40,7 @@ describe Rasti::Form do
|
|
40
40
|
|
41
41
|
it 'Invalid attributes' do
|
42
42
|
error = proc { point_class.new z: 3 }.must_raise Rasti::Form::ValidationError
|
43
|
-
error.message.must_equal "Validation errors:\n- z: [\"unexpected attribute\"]
|
43
|
+
error.message.must_equal "Validation errors:\n- z: [\"unexpected attribute\"]"
|
44
44
|
end
|
45
45
|
|
46
46
|
describe 'Casting' do
|
@@ -86,7 +86,7 @@ describe Rasti::Form do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
error = proc { form.new boolean: 'x', number: 'y' }.must_raise Rasti::Form::ValidationError
|
89
|
-
error.message.must_equal "Validation errors:\n- boolean: [\"Invalid cast: \'x\' -> Rasti::Form::Types::Boolean\"]\n- number: [\"Invalid cast: \'y\' -> Rasti::Form::Types::Integer\"]
|
89
|
+
error.message.must_equal "Validation errors:\n- boolean: [\"Invalid cast: \'x\' -> Rasti::Form::Types::Boolean\"]\n- number: [\"Invalid cast: \'y\' -> Rasti::Form::Types::Integer\"]"
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'Invalid nested attributes' do
|
@@ -95,7 +95,7 @@ describe Rasti::Form do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
error = proc { form.new range: {min: 'x', max: 'y'} }.must_raise Rasti::Form::ValidationError
|
98
|
-
error.message.must_equal "Validation errors:\n- range.min: [\"Invalid cast: 'x' -> Rasti::Form::Types::Integer\"]\n- range.max: [\"Invalid cast: 'y' -> Rasti::Form::Types::Integer\"]
|
98
|
+
error.message.must_equal "Validation errors:\n- range.min: [\"Invalid cast: 'x' -> Rasti::Form::Types::Integer\"]\n- range.max: [\"Invalid cast: 'y' -> Rasti::Form::Types::Integer\"]"
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'Invalid form attributes' do
|
@@ -109,7 +109,7 @@ describe Rasti::Form do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
error = proc { form.new range: {min: 'x', max: 'y'} }.must_raise Rasti::Form::ValidationError
|
112
|
-
error.message.must_equal "Validation errors:\n- range.min: [\"Invalid cast: 'x' -> Rasti::Form::Types::Integer\"]\n- range.max: [\"Invalid cast: 'y' -> Rasti::Form::Types::Integer\"]
|
112
|
+
error.message.must_equal "Validation errors:\n- range.min: [\"Invalid cast: 'x' -> Rasti::Form::Types::Integer\"]\n- range.max: [\"Invalid cast: 'y' -> Rasti::Form::Types::Integer\"]"
|
113
113
|
end
|
114
114
|
|
115
115
|
end
|
@@ -155,7 +155,7 @@ describe Rasti::Form do
|
|
155
155
|
proc { form.new text: 'text' }.must_be_silent
|
156
156
|
|
157
157
|
error = proc { form.new }.must_raise Rasti::Form::ValidationError
|
158
|
-
error.message.must_equal "Validation errors:\n- text: [\"Invalid text\"]
|
158
|
+
error.message.must_equal "Validation errors:\n- text: [\"Invalid text\"]"
|
159
159
|
end
|
160
160
|
|
161
161
|
it 'Required' do
|
@@ -170,7 +170,7 @@ describe Rasti::Form do
|
|
170
170
|
proc { form.new text: 'text' }.must_be_silent
|
171
171
|
|
172
172
|
error = proc { form.new }.must_raise Rasti::Form::ValidationError
|
173
|
-
error.message.must_equal "Validation errors:\n- text: [\"not present\"]
|
173
|
+
error.message.must_equal "Validation errors:\n- text: [\"not present\"]"
|
174
174
|
end
|
175
175
|
|
176
176
|
it 'Required when cast failed' do
|
@@ -185,7 +185,7 @@ describe Rasti::Form do
|
|
185
185
|
proc { form.new number: 1 }.must_be_silent
|
186
186
|
|
187
187
|
error = proc { form.new number: 'text' }.must_raise Rasti::Form::ValidationError
|
188
|
-
error.message.must_equal "Validation errors:\n- number: [\"Invalid cast: 'text' -> Rasti::Form::Types::Integer\"]
|
188
|
+
error.message.must_equal "Validation errors:\n- number: [\"Invalid cast: 'text' -> Rasti::Form::Types::Integer\"]"
|
189
189
|
end
|
190
190
|
|
191
191
|
it 'Not required' do
|
@@ -200,7 +200,7 @@ describe Rasti::Form do
|
|
200
200
|
proc { form.new }.must_be_silent
|
201
201
|
|
202
202
|
error = proc { form.new text: 'text' }.must_raise Rasti::Form::ValidationError
|
203
|
-
error.message.must_equal "Validation errors:\n- text: [\"is present\"]
|
203
|
+
error.message.must_equal "Validation errors:\n- text: [\"is present\"]"
|
204
204
|
end
|
205
205
|
|
206
206
|
it 'Not empty string' do
|
@@ -215,7 +215,7 @@ describe Rasti::Form do
|
|
215
215
|
proc { form.new text: 'text' }.must_be_silent
|
216
216
|
|
217
217
|
error = proc { form.new text: ' ' }.must_raise Rasti::Form::ValidationError
|
218
|
-
error.message.must_equal "Validation errors:\n- text: [\"is empty\"]
|
218
|
+
error.message.must_equal "Validation errors:\n- text: [\"is empty\"]"
|
219
219
|
end
|
220
220
|
|
221
221
|
it 'Not empty array' do
|
@@ -230,7 +230,7 @@ describe Rasti::Form do
|
|
230
230
|
proc { form.new array: ['text'] }.must_be_silent
|
231
231
|
|
232
232
|
error = proc { form.new array: [] }.must_raise Rasti::Form::ValidationError
|
233
|
-
error.message.must_equal "Validation errors:\n- array: [\"is empty\"]
|
233
|
+
error.message.must_equal "Validation errors:\n- array: [\"is empty\"]"
|
234
234
|
end
|
235
235
|
|
236
236
|
it 'Included in values list' do
|
@@ -245,7 +245,7 @@ describe Rasti::Form do
|
|
245
245
|
proc { form.new text: 'value_1' }.must_be_silent
|
246
246
|
|
247
247
|
error = proc { form.new text: 'xyz' }.must_raise Rasti::Form::ValidationError
|
248
|
-
error.message.must_equal "Validation errors:\n- text: [\"not included in \'value_1\', \'value_2\'\"]
|
248
|
+
error.message.must_equal "Validation errors:\n- text: [\"not included in \'value_1\', \'value_2\'\"]"
|
249
249
|
end
|
250
250
|
|
251
251
|
it 'Time range' do
|
@@ -264,7 +264,7 @@ describe Rasti::Form do
|
|
264
264
|
proc { form.new from: from, to: to }.must_be_silent
|
265
265
|
|
266
266
|
error = proc { form.new from: to.to_s, to: from.to_s }.must_raise Rasti::Form::ValidationError
|
267
|
-
error.message.must_equal "Validation errors:\n- from: [\"invalid time range\"]
|
267
|
+
error.message.must_equal "Validation errors:\n- from: [\"invalid time range\"]"
|
268
268
|
end
|
269
269
|
|
270
270
|
it 'Nested form' do
|
@@ -280,7 +280,7 @@ describe Rasti::Form do
|
|
280
280
|
proc { form.new range: {min: 1, max: 2} }.must_be_silent
|
281
281
|
|
282
282
|
error = proc { form.new }.must_raise Rasti::Form::ValidationError
|
283
|
-
error.message.must_equal "Validation errors:\n- range.min: [\"not present\"]\n- range.max: [\"not present\"]
|
283
|
+
error.message.must_equal "Validation errors:\n- range.min: [\"not present\"]\n- range.max: [\"not present\"]"
|
284
284
|
end
|
285
285
|
|
286
286
|
it 'Nested validation' do
|
@@ -300,7 +300,7 @@ describe Rasti::Form do
|
|
300
300
|
proc { form.new range: {min: 1, max: 2} }.must_be_silent
|
301
301
|
|
302
302
|
error = proc { form.new range: {min: 2, max: 1} }.must_raise Rasti::Form::ValidationError
|
303
|
-
error.message.must_equal "Validation errors:\n- range.min: [\"Min must be less than Max\"]
|
303
|
+
error.message.must_equal "Validation errors:\n- range.min: [\"Min must be less than Max\"]"
|
304
304
|
end
|
305
305
|
|
306
306
|
end
|
data/spec/types/array_spec.rb
CHANGED
@@ -46,7 +46,7 @@ describe Rasti::Form::Types::Array do
|
|
46
46
|
|
47
47
|
error.errors.must_equal 'points.2.x' => ["Invalid cast: 'a' -> Rasti::Form::Types::Integer"],
|
48
48
|
'points.3.y' => ["Invalid cast: 'b' -> Rasti::Form::Types::Integer"]
|
49
|
-
error.message.must_equal "Validation errors:\n- points.2.x: [\"Invalid cast: 'a' -> Rasti::Form::Types::Integer\"]\n- points.3.y: [\"Invalid cast: 'b' -> Rasti::Form::Types::Integer\"]
|
49
|
+
error.message.must_equal "Validation errors:\n- points.2.x: [\"Invalid cast: 'a' -> Rasti::Form::Types::Integer\"]\n- points.3.y: [\"Invalid cast: 'b' -> Rasti::Form::Types::Integer\"]"
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
data/spec/types/form_spec.rb
CHANGED
@@ -35,7 +35,7 @@ describe Rasti::Form::Types::Form do
|
|
35
35
|
|
36
36
|
it '{x: "text"} -> ValidationError' do
|
37
37
|
error = proc { Rasti::Form::Types::Form[form].cast x: 'test' }.must_raise Rasti::Form::ValidationError
|
38
|
-
error.message.must_equal "Validation errors:\n- x: [\"Invalid cast: 'test' -> Rasti::Form::Types::Integer\"]
|
38
|
+
error.message.must_equal "Validation errors:\n- x: [\"Invalid cast: 'test' -> Rasti::Form::Types::Integer\"]"
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rasti-form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_require
|