govuk_schemas 3.3.0 → 4.0.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/CHANGELOG.md +7 -0
- data/lib/govuk_schemas/rspec_matchers.rb +11 -21
- data/lib/govuk_schemas/version.rb +1 -1
- 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: ea94b4761eda43eaa50a5b427a3f69d30e59e305
|
4
|
+
data.tar.gz: 807faf434f8cfa3f5889a242246dc5d8ee1d3b50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85fd714ebee2934bd4ae5909513c1a17048537d0400c1e9cbc6548b1454150166b84f27356816b72e4a861f9caf41f54f048a03f75dc5b06835b9c7a6563f324
|
7
|
+
data.tar.gz: d6a12b301721a3c2d5a52a129becdb48aff183e19673082a47d48489172c0baa4c84751d7258fa1a7eac7dded42f7cab11c227352cc47f3312cf4fbf303b685b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 4.0.0
|
2
|
+
|
3
|
+
* Change RSpec::Matchers, rename `be_valid_against_schema` to
|
4
|
+
`be_valid_against_publisher_schema` and add
|
5
|
+
`be_valid_against_frontend_schema` plus
|
6
|
+
`be_valid_against_notification_schema`.
|
7
|
+
|
1
8
|
# 3.3.0
|
2
9
|
|
3
10
|
* Support generating objects with an `oneOf` property.
|
@@ -1,26 +1,16 @@
|
|
1
1
|
module GovukSchemas
|
2
2
|
module RSpecMatchers
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
RSpec::Matchers.define :be_valid_against_links_schema do |schema_name|
|
16
|
-
match do |item|
|
17
|
-
schema = Schema.find(links_schema: schema_name)
|
18
|
-
validator = JSON::Validator.fully_validate(schema, item)
|
19
|
-
validator.empty?
|
20
|
-
end
|
21
|
-
|
22
|
-
failure_message do |actual|
|
23
|
-
ValidationErrorMessage.new(schema_name, "links", actual).message
|
3
|
+
%w[links frontend publisher notification].each do |schema_type|
|
4
|
+
RSpec::Matchers.define "be_valid_against_#{schema_type}_schema".to_sym do |schema_name|
|
5
|
+
match do |item|
|
6
|
+
schema = Schema.find(Hash["#{schema_type}_schema".to_sym, schema_name])
|
7
|
+
validator = JSON::Validator.fully_validate(schema, item)
|
8
|
+
validator.empty?
|
9
|
+
end
|
10
|
+
|
11
|
+
failure_message do |actual|
|
12
|
+
ValidationErrorMessage.new(schema_name, "schema", actual).message
|
13
|
+
end
|
24
14
|
end
|
25
15
|
end
|
26
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_schemas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|