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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a224235eed2698cb81f4eb4aef2f3e5286672e7f1d9eb07291248f8ccbdab6c
4
- data.tar.gz: 96d5323f9895bd998c035e36f7c630bb94c5ec49ea660d3849a5ed33a1d9a526
3
+ metadata.gz: 23df9acac7261f11ec2af29f172929cad39d28ad1da8645abe2c5e56f3a8a677
4
+ data.tar.gz: 3a2635d2d6bb3859162c3e4ee46114360f0b3b7e921b4e00190113da7eb20f6c
5
5
  SHA512:
6
- metadata.gz: 5338e229b4b4bcff35659e9548ceb85d0ed431449a3995c1de1cdb317e33a5ea64925f29c16f268abe1923ebf219b0500e9a0dc8d0b9dbe694632a362ef6edfb
7
- data.tar.gz: 3721da96ad09533f0af2cd93539728224ad42390b43583ac30441b2f30d12e10d082cb8132e30546dd9f65d711dc9524f54156e0a66c642ea7cba51427c6175a
6
+ metadata.gz: 8e7d2243fb7ed8259794be08fd2beca6673a9dc35d6956dde306bda7ff9e5a36f065e82fabc052db38837b28349fc73705ccaf3e51fc1d6837273676d6536bf8
7
+ data.tar.gz: 7d0aafa016d031267c6ae140c10b473de8e50a13085f732ccbee9b93d5b41b2286950e70b8c4c7ba63b59df63798f479f87df7286d85ed516953560bbd18f37e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- json_rspec_match_maker (1.1.3)
4
+ json_rspec_match_maker (1.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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!(expand_sub_definition(key))
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 expand_sub_definition(sub_definition)
73
- subkey = sub_definition.keys.first
74
- return sub_definition if sub_definition[subkey].respond_to? :call
75
- sub_definition[subkey][:attributes] = expand_definition(sub_definition[subkey][:attributes])
76
- sub_definition
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsonRspecMatchMaker
4
- VERSION = '1.1.3'
4
+ VERSION = '1.1.4'
5
5
  end
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.3
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-15 00:00:00.000000000 Z
11
+ date: 2018-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler