easy_json_matcher 0.4.0 → 0.4.1

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
  SHA1:
3
- metadata.gz: f5594d2bf04fe24083c5ffe568e88f22accbee84
4
- data.tar.gz: 19de26378a180c35d80ffc5c21fa4cff5064ceb5
3
+ metadata.gz: ef40172819f1511b343e9f3dc378da1730ae0576
4
+ data.tar.gz: 56913c7ee1b59003fb4949180b7bc2985803cee6
5
5
  SHA512:
6
- metadata.gz: 9934c3a54200cc1b4ceb0de8a25ef45509445df8330820db4324270967437038ec48964a7bc91fb9be4c0e2a86bf96ead52e0209d1e0fbb15185632202073713
7
- data.tar.gz: 44fb3187668459fd709e3a916668411f1f7749ebcad47d32d717ec870fa983bfd800557d5be2e1b2d98343788d44ede157fce4317a7387e40bcee7922bc188ba
6
+ metadata.gz: 12e86e84712085c21d57f9db7606ea38577cfd2a590fe1c20b6b4ae67c6acb6bc09d630ec2cff2e70cc2c92c20b01a86a3a3da93302b53646a593242846f3549
7
+ data.tar.gz: 5ba4fffa36e432c1b5f52ebfb350734840931d04073c89651f9ded8729cdc90bf709d4b77c52dad5076a09f37a8fdc064463999b8af0005dedb27feb4079046e
@@ -12,6 +12,7 @@ module EasyJSONMatcher
12
12
  @validators = {}
13
13
  @node_opts = extract_opts(local: opts, global: global_opts)
14
14
  @global_opts = global_opts
15
+ yield self if block_given?
15
16
  end
16
17
 
17
18
  def generate_node
@@ -25,6 +26,7 @@ module EasyJSONMatcher
25
26
  end
26
27
 
27
28
  def contains_node(key:, opts: [], &block)
29
+ if key == "alpha_2" then byebug end
28
30
  generator = self.class.new(opts: opts, global_opts: global_opts, &block)
29
31
  validators[key] = generator.generate_node
30
32
  end
@@ -1,3 +1,3 @@
1
1
  module EasyJSONMatcher
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.4.1".freeze
3
3
  end
@@ -79,10 +79,10 @@ module EasyJSONMatcher
79
79
  test "It can validate JSON Schema payloads" do
80
80
  SchemaGenerator.new {
81
81
  has_attribute key: "id", opts: [:number, :required]
82
- contains_node(key: "attributes") do
83
- has_attribute key: "alpha_2", opts: [ :string, :required ]
84
- has_attribute key: "alpha_3", opts: [ :string, :required ]
85
- has_attribute key: "name", opts: [ :string, :required ]
82
+ contains_node(key: "attributes") do |node|
83
+ node.has_attribute key: "alpha_2", opts: [ :string, :required ]
84
+ node.has_attribute key: "alpha_3", opts: [ :string, :required ]
85
+ node.has_attribute key: "name", opts: [ :string, :required ]
86
86
  end
87
87
  }.register(as: :country)
88
88
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_json_matcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - WJD Hamilton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-04 00:00:00.000000000 Z
11
+ date: 2017-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-auto_inject
@@ -132,37 +132,37 @@ signing_key:
132
132
  specification_version: 4
133
133
  summary: Easily test your JSON output with templates and Schemas
134
134
  test_files:
135
- - test/array_content_validator_test.rb
136
- - test/custom_validations_test.rb
137
- - test/global_validation_options_test.rb
138
- - test/json_api_home.txt
139
- - test/json_coercer_test.rb
135
+ - test/primitives_boolean_test.rb
140
136
  - test/managing_schemas_test.rb
137
+ - test/validation_step_test.rb
141
138
  - test/node_test.rb
142
- - test/plural_key_defs_test.rb
143
- - test/primitives_boolean_test.rb
144
- - test/primitives_date_test.rb
139
+ - test/json_coercer_test.rb
145
140
  - test/primitives_number_test.rb
146
- - test/primitives_object_test.rb
147
- - test/primitives_string_test.rb
148
141
  - test/primtives_value_test.rb
149
- - test/required_validation_test.rb
150
- - test/schema_generator_test.rb
151
- - test/shortened_names_test.rb
152
- - test/strict_mode_test.rb
153
- - test/test_helper.rb
154
- - test/validating_arrays_test.rb
155
- - test/validation_chain_factory_test.rb
156
- - test/validation_chain_test_helper.rb
157
- - test/validation_step_array_test.rb
158
- - test/validation_step_boolean_test.rb
142
+ - test/validation_step_value_test.rb
143
+ - test/validation_step_object_test.rb
144
+ - test/array_content_validator_test.rb
145
+ - test/json_api_home.txt
146
+ - test/validator_set_test.rb
147
+ - test/plural_key_defs_test.rb
159
148
  - test/validation_step_date_test.rb
160
149
  - test/validation_step_not_required_test.rb
150
+ - test/strict_mode_test.rb
161
151
  - test/validation_step_number_test.rb
162
- - test/validation_step_object_test.rb
163
- - test/validation_step_required_test.rb
164
- - test/validation_step_string_test.rb
165
- - test/validation_step_test.rb
166
- - test/validation_step_value_test.rb
167
- - test/validator_set_test.rb
168
152
  - test/validator_test.rb
153
+ - test/primitives_object_test.rb
154
+ - test/shortened_names_test.rb
155
+ - test/primitives_date_test.rb
156
+ - test/global_validation_options_test.rb
157
+ - test/validation_step_array_test.rb
158
+ - test/required_validation_test.rb
159
+ - test/validation_chain_factory_test.rb
160
+ - test/schema_generator_test.rb
161
+ - test/validation_step_string_test.rb
162
+ - test/validation_chain_test_helper.rb
163
+ - test/validation_step_required_test.rb
164
+ - test/custom_validations_test.rb
165
+ - test/test_helper.rb
166
+ - test/validation_step_boolean_test.rb
167
+ - test/validating_arrays_test.rb
168
+ - test/primitives_string_test.rb