json_rspec_match_maker 1.1.3 → 1.1.4
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/Gemfile.lock +1 -1
- data/lib/json_rspec_match_maker/base.rb +7 -11
- data/lib/json_rspec_match_maker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23df9acac7261f11ec2af29f172929cad39d28ad1da8645abe2c5e56f3a8a677
|
4
|
+
data.tar.gz: 3a2635d2d6bb3859162c3e4ee46114360f0b3b7e921b4e00190113da7eb20f6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e7d2243fb7ed8259794be08fd2beca6673a9dc35d6956dde306bda7ff9e5a36f065e82fabc052db38837b28349fc73705ccaf3e51fc1d6837273676d6536bf8
|
7
|
+
data.tar.gz: 7d0aafa016d031267c6ae140c10b473de8e50a13085f732ccbee9b93d5b41b2286950e70b8c4c7ba63b59df63798f479f87df7286d85ed516953560bbd18f37e
|
data/Gemfile.lock
CHANGED
@@ -62,18 +62,19 @@ module JsonRspecMatchMaker
|
|
62
62
|
if key.is_a? String
|
63
63
|
result[key] = :default
|
64
64
|
elsif key.is_a? Hash
|
65
|
-
result.merge!(
|
65
|
+
result.merge!(expand_sub_definitions(key))
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
70
|
# expands nested simple definition into a full hash
|
71
71
|
# @api private
|
72
|
-
def
|
73
|
-
subkey
|
74
|
-
|
75
|
-
|
76
|
-
|
72
|
+
def expand_sub_definitions(sub_definitions)
|
73
|
+
sub_definitions.each_with_object({}) do |(subkey, value), result|
|
74
|
+
result[subkey] = value
|
75
|
+
next if value.respond_to? :call
|
76
|
+
result[subkey][:attributes] = expand_definition(value[:attributes])
|
77
|
+
end
|
77
78
|
end
|
78
79
|
|
79
80
|
# Walks through the match definition, collecting errors for each field
|
@@ -119,11 +120,6 @@ module JsonRspecMatchMaker
|
|
119
120
|
# a function returning the value for the key for the object being serialized
|
120
121
|
# @param expected_instance [Object]
|
121
122
|
# the top level instance, or an each instance from #check_each
|
122
|
-
# @param each_opts [nil, Hash]
|
123
|
-
# nil if checking a top level value
|
124
|
-
# Hash if iterating through a list
|
125
|
-
# :idx the current index
|
126
|
-
# :error_key the subfield reported in the error
|
127
123
|
# the index if iterating through a list, otherwise nil
|
128
124
|
# @return [nil] returns nothing, adds to error list as side effect
|
129
125
|
def check_values(key_prefix, error_key, match_function, expected_instance = expected)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_rspec_match_maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick McGee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|