json_model_rb 0.1.9 → 0.1.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49c30126ff23f7ec073ef981be5682bb6db7976e4d3f7fde6e5ad5c26b3fc7d8
4
- data.tar.gz: 88e4abe3490277fc63c1f3b4d612dc398cb68e982c1038d00cf75fce7bff2759
3
+ metadata.gz: 98bb614ecc704ac48a1a6d72b079f26eae33b6e6e392c64309ef3dead031cef3
4
+ data.tar.gz: cae571a4e4f58b34a1c5add1135ebbe8382dcf588a40fcdca719343addaf66b5
5
5
  SHA512:
6
- metadata.gz: 782eebf325932cd06bccf71c410e5a820868bf07989372da9b6329b8e3e2eaab68fea6c16e4d2234279d57cee3c831871c786507618914683b30ce57aec0bf37
7
- data.tar.gz: 235dce29d095bab73e393c39b6912ffb1de547a52de845a4a3c309a14b7584baa816d5f71584a4ead8a1c2b64f5210956541e747ef059774a5c721c34647bcc1
6
+ metadata.gz: 0c7d8e9859704abbdc88e0659de62c34c586e448288e58063f80a7448a5c0c32ccf374146ed14488a1ee67f6a358e80f162fb4b9cd79a531b479c89bc5d814e0
7
+ data.tar.gz: 9a2ca8d4b13ee9ac3ff8fb6e68adca65bdad4a320f2216fe5a277842a1feacf5f5aa0b9f3049ab39658c3f6fa5f833339bfcca967e7782ce9068e9039dde8dfb
@@ -26,7 +26,7 @@ module JsonModel
26
26
  def register_validations(name, klass)
27
27
  super
28
28
 
29
- klass.validates(name, inclusion: { in: @value })
29
+ klass.validates(name, inclusion: { in: @value }, allow_nil: true)
30
30
  end
31
31
  end
32
32
  end
@@ -26,7 +26,7 @@ module JsonModel
26
26
  def register_validations(name, klass)
27
27
  super
28
28
 
29
- klass.validates(name, inclusion: { in: @values })
29
+ klass.validates(name, inclusion: { in: @values }, allow_nil: true)
30
30
  end
31
31
  end
32
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsonModel
4
- VERSION = '0.1.9'
4
+ VERSION = '0.1.10'
5
5
  end
@@ -34,7 +34,7 @@ RSpec.describe(JsonModel::TypeSpec::Enum) do
34
34
  described_class
35
35
  .new(1)
36
36
  .register_validations(:foo, klass)
37
- instance = klass.new(foo: nil)
37
+ instance = klass.new(foo: 2)
38
38
 
39
39
  expect(instance.valid?)
40
40
  .to(be(false))
@@ -62,15 +62,6 @@ RSpec.describe(JsonModel::TypeSpec::Enum) do
62
62
  .register_validations(:foo, klass)
63
63
  end
64
64
 
65
- it('fails the validation if nil') do
66
- instance = klass.new(foo: nil)
67
-
68
- expect(instance.valid?)
69
- .to(be(false))
70
- expect(instance.errors.map(&:type))
71
- .to(eq(%i(inclusion)))
72
- end
73
-
74
65
  it('fails the validation if not allowed') do
75
66
  instance = klass.new(foo: 0)
76
67
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_model_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Gillesberger