strong_json 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/strong_json/type.rb +1 -1
- data/lib/strong_json/version.rb +1 -1
- data/spec/object_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5ae6973c112d772bdc495d5d50d5148f767bc71
|
4
|
+
data.tar.gz: 9c08bcd7842863cd40b727bf05007fec4be82f23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6da4d4154502cc0bc422b1b5b1ff22c2033972d5cda06cdaeee3241c5d4eaa511151f622a6297e00dbaad632e20591fe67e1b9415cf755bd44ff83f9c77f5cc7
|
7
|
+
data.tar.gz: 50668c460b0ac655c48b6a93b4fd1e8c631474e1b70ab3c2850a4bf54e0ac92419a618d708e36fe3ab420f0189f3a61bd1e009019a4ccc51703bf989d02c8e63
|
data/lib/strong_json/type.rb
CHANGED
data/lib/strong_json/version.rb
CHANGED
data/spec/object_spec.rb
CHANGED
@@ -65,6 +65,18 @@ describe StrongJSON::Type::Object do
|
|
65
65
|
|
66
66
|
expect{ ty2.coerce(a: 123) }.to raise_error(StrongJSON::Type::Error)
|
67
67
|
end
|
68
|
+
|
69
|
+
it "adds field via object" do
|
70
|
+
ty2 = type.merge(StrongJSON::Type::Object.new(b: StrongJSON::Type::Base.new(:string)))
|
71
|
+
|
72
|
+
expect(ty2.coerce(a: 123, b: "test")).to eq(a: 123, b: "test")
|
73
|
+
end
|
74
|
+
|
75
|
+
it "overrides field via object" do
|
76
|
+
ty2 = type.merge(StrongJSON::Type::Object.new(a: StrongJSON::Type::Base.new(:prohibited)))
|
77
|
+
|
78
|
+
expect{ ty2.coerce(a: 123) }.to raise_error(StrongJSON::Type::Error)
|
79
|
+
end
|
68
80
|
end
|
69
81
|
|
70
82
|
describe "#except" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|