rspec-document_requests 1.3.0 → 1.3.1

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: 4fedfef2a8965ead1fee4d9cb58371e3ea061814
4
- data.tar.gz: f6712172151b7e9ba4a8c8897ccfdcfd4c25c5df
3
+ metadata.gz: f229f7cf9a8e4fcb4d90515015a169d7960be159
4
+ data.tar.gz: c6d9c232d90e20e64e886dd7647bcd35f829cfce
5
5
  SHA512:
6
- metadata.gz: 50c3b3868f1a0a7c32851ddab4eba661901ff0a7675ebbc50d34b9854396ccff66939f50a23fd3378d051b3f028d6668c19a9d350758da37600a1eb3390368ec
7
- data.tar.gz: 4fc2781de76cc5ed2fdda452a19079604e95a20dcac27023d96b2da05de2aed597bb1283fd4f6b9084fc98cd229ad2e5b03df6acd1ee5a816b142de6624996c3
6
+ metadata.gz: b89fffd618c1105740a270287f23bc7bdeb9ef9b77c2557e12c097926af1a08f58f2a39cbf79539cbb72fcc7daf1a168d2f2001a7f419a960c7a0e3f7cb85cef
7
+ data.tar.gz: 763953cc2191e23a0fc1109c648682fb64f1700508ec83ee9a0657f87446278bfc63f425ccfb7cd20ea85835c95ba5b4dc9fb4bf4cbbdf5196725a53585ba5cf
@@ -92,24 +92,22 @@ module RSpec
92
92
 
93
93
  def process_parameters(input, output, explanation:, prefix: nil)
94
94
  input.each do |key, value|
95
- name = prefix ? "#{prefix}[#{key}]" : key.to_s
95
+ key, value = nil, key if input.is_a?(Array)
96
+ if prefix
97
+ name = "#{prefix}[#{key}]"
98
+ else
99
+ name = input.is_a?(Array) ? "[]" : key.to_s
100
+ end
96
101
  case value
97
102
  when Hash
98
103
  process_parameters(value, output, explanation: explanation, prefix: name)
99
104
  when Array
100
- name += "[]"
101
- base_values = []
102
- value.each do |subvalue|
103
- case subvalue
104
- when Hash
105
- process_parameters(subvalue, output, explanation: explanation, prefix: name)
106
- else
107
- base_values << subvalue
108
- end
109
- end
110
- if base_values.any?
105
+ if value.all? { |subvalue| subvalue.is_a?(Hash) }
106
+ process_parameters(value, output, explanation: explanation, prefix: name)
107
+ else
108
+ name += "[]"
111
109
  output[name] ||= explanation[name] || Parameter.new(generated: true)
112
- output[name].value = [output[name].value, base_values.to_s].compact.join(", ")
110
+ output[name].value = [output[name].value, value.to_s].compact.join(", ")
113
111
  end
114
112
  else
115
113
  output[name] ||= explanation[name] || Parameter.new(generated: true)
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module DocumentRequests
3
- VERSION = "1.3.0"
3
+ VERSION = "1.3.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-document_requests
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Niv