schemacop 3.0.8 → 3.0.12
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/.github/workflows/ruby.yml +27 -0
- data/.releaser_config +0 -1
- data/CHANGELOG.md +18 -0
- data/README.md +1 -1
- data/README_V3.md +129 -40
- data/VERSION +1 -1
- data/lib/schemacop/v3/combination_node.rb +1 -1
- data/lib/schemacop/v3/node.rb +6 -5
- data/lib/schemacop/v3/one_of_node.rb +23 -1
- data/lib/schemacop/v3/string_node.rb +8 -2
- data/schemacop.gemspec +30 -18
- data/test/unit/schemacop/v3/array_node_test.rb +19 -17
- data/test/unit/schemacop/v3/boolean_node_test.rb +40 -7
- data/test/unit/schemacop/v3/hash_node_test.rb +49 -11
- data/test/unit/schemacop/v3/integer_node_test.rb +38 -14
- data/test/unit/schemacop/v3/node_test.rb +10 -0
- data/test/unit/schemacop/v3/number_node_test.rb +14 -9
- data/test/unit/schemacop/v3/object_node_test.rb +7 -7
- data/test/unit/schemacop/v3/one_of_node_test.rb +12 -0
- data/test/unit/schemacop/v3/reference_node_test.rb +4 -4
- data/test/unit/schemacop/v3/string_node_test.rb +60 -11
- data/test/unit/schemacop/v3/symbol_node_test.rb +9 -6
- metadata +4 -4
- data/.travis.yml +0 -9
@@ -3,7 +3,10 @@ require 'test_helper'
|
|
3
3
|
module Schemacop
|
4
4
|
module V3
|
5
5
|
class SymbolNodeTest < V3Test
|
6
|
-
|
6
|
+
def self.invalid_type_error(type)
|
7
|
+
type = type.class unless type.class == Class
|
8
|
+
"Invalid type, got type \"#{type}\", expected \"Symbol\"."
|
9
|
+
end
|
7
10
|
|
8
11
|
def test_basic
|
9
12
|
schema :symbol
|
@@ -11,10 +14,10 @@ module Schemacop
|
|
11
14
|
assert_validation :foo
|
12
15
|
assert_validation :'n0238n)Q(hqr3hrw3'
|
13
16
|
assert_validation 42 do
|
14
|
-
error '/',
|
17
|
+
error '/', SymbolNodeTest.invalid_type_error(Integer)
|
15
18
|
end
|
16
19
|
assert_validation '42' do
|
17
|
-
error '/',
|
20
|
+
error '/', SymbolNodeTest.invalid_type_error(String)
|
18
21
|
end
|
19
22
|
assert_json({})
|
20
23
|
end
|
@@ -56,13 +59,13 @@ module Schemacop
|
|
56
59
|
# Even we put those types in the enum, they need to fail the validations,
|
57
60
|
# as they are not symbols
|
58
61
|
assert_validation('foo') do
|
59
|
-
error '/',
|
62
|
+
error '/', SymbolNodeTest.invalid_type_error(String)
|
60
63
|
end
|
61
64
|
assert_validation(1) do
|
62
|
-
error '/',
|
65
|
+
error '/', SymbolNodeTest.invalid_type_error(Integer)
|
63
66
|
end
|
64
67
|
assert_validation({ qux: 42 }) do
|
65
|
-
error '/',
|
68
|
+
error '/', SymbolNodeTest.invalid_type_error(Hash)
|
66
69
|
end
|
67
70
|
|
68
71
|
# These need to fail validation, as they are not in the enum list
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schemacop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sitrox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -170,10 +170,10 @@ executables: []
|
|
170
170
|
extensions: []
|
171
171
|
extra_rdoc_files: []
|
172
172
|
files:
|
173
|
+
- ".github/workflows/ruby.yml"
|
173
174
|
- ".gitignore"
|
174
175
|
- ".releaser_config"
|
175
176
|
- ".rubocop.yml"
|
176
|
-
- ".travis.yml"
|
177
177
|
- ".yardopts"
|
178
178
|
- CHANGELOG.md
|
179
179
|
- Gemfile
|
@@ -292,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
292
|
- !ruby/object:Gem::Version
|
293
293
|
version: '0'
|
294
294
|
requirements: []
|
295
|
-
rubygems_version: 3.
|
295
|
+
rubygems_version: 3.0.3
|
296
296
|
signing_key:
|
297
297
|
specification_version: 4
|
298
298
|
summary: Schemacop validates ruby structures consisting of nested hashes and arrays
|