govuk_schemas 3.3.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 345030ceca3637693cb97b1f7ae278a95998880a
4
- data.tar.gz: 4b2bfb4865a81442d7ec8c18acbf83b394c2a58e
3
+ metadata.gz: ea94b4761eda43eaa50a5b427a3f69d30e59e305
4
+ data.tar.gz: 807faf434f8cfa3f5889a242246dc5d8ee1d3b50
5
5
  SHA512:
6
- metadata.gz: 41557290549c44945a885bfaea6ad72cba73fef4050a9a7d1c23f89fa56a13925a598580362dfee42ff7b066664b2e018173234b4c7b120ad5dc567741e7140c
7
- data.tar.gz: 5af51d7f613812c5385f4294195dcf7fcc3184abdd85c78051d47c6654e3a7a1b0e155e84d51619cab0f15dce6d78607736f96dd4c239c118b4dd0d235f3389c
6
+ metadata.gz: 85fd714ebee2934bd4ae5909513c1a17048537d0400c1e9cbc6548b1454150166b84f27356816b72e4a861f9caf41f54f048a03f75dc5b06835b9c7a6563f324
7
+ data.tar.gz: d6a12b301721a3c2d5a52a129becdb48aff183e19673082a47d48489172c0baa4c84751d7258fa1a7eac7dded42f7cab11c227352cc47f3312cf4fbf303b685b
@@ -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
- RSpec::Matchers.define :be_valid_against_schema do |schema_name|
4
- match do |item|
5
- schema = Schema.find(publisher_schema: schema_name)
6
- validator = JSON::Validator.fully_validate(schema, item)
7
- validator.empty?
8
- end
9
-
10
- failure_message do |actual|
11
- ValidationErrorMessage.new(schema_name, "schema", actual).message
12
- end
13
- end
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
@@ -1,4 +1,4 @@
1
1
  module GovukSchemas
2
2
  # @private
3
- VERSION = "3.3.0".freeze
3
+ VERSION = "4.0.0".freeze
4
4
  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: 3.3.0
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-08 00:00:00.000000000 Z
11
+ date: 2019-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema