rspec-document_requests 1.0.1 → 1.1.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: 03e9589029b92f3ada8618b326ff040977a76133
4
- data.tar.gz: e9716f03981863fd054f918b3a44ef1c81aec23d
3
+ metadata.gz: 231e877c797beff56b6713d86e7247cf7e31ea72
4
+ data.tar.gz: 06f5cbf0269fa7c3d5f772425081619327ef7ab7
5
5
  SHA512:
6
- metadata.gz: eb10351bf8ef26ecd1a8553e270391dfcde8d0a057331fefcedcce769cd52b03e4e5dc605978886225848427c2e57195b2cf8521a69293413c0a5484faa1e8eb
7
- data.tar.gz: c37df01da4e7339431a5c5431a1cd65fc1a4d76b8a8ee0c8bdd5aa7d6b8511a80490c09dcd7443ee9f8a9f3cd8ac4515fdda9d4cacf8db78b360be61fb5e264c
6
+ metadata.gz: efc0c7d69098f85741a3cbc27e395e6addb62510226ac4398a4c27e624d3c910e8eeb4dbb488c5d27e0e1219c1852eda4b14749569ec7239392789cc9f7cf116
7
+ data.tar.gz: 3cff5a55338cf639810fc696855c0aa9089f78e5629969447c7f5ddfa6eb157a7cf07c32fa419b9c1ffb17e65698c4ba4ec4a22f3e7b6683bed850fe8442f0d1
@@ -95,11 +95,27 @@ module RSpec
95
95
  def process_parameters(input, output, explanation:, prefix: nil)
96
96
  input.each do |key, value|
97
97
  name = prefix ? "#{prefix}[#{key}]" : key
98
- if value.is_a?(Hash)
99
- process_parameters(value, output, explanation: explanation, prefix: name)
100
- else
101
- output[name] = explanation[name] || Parameter.new
102
- output[name].value = value
98
+ case value
99
+ when Hash
100
+ process_parameters(value, output, explanation: explanation, prefix: name)
101
+ when Array
102
+ name += "[]"
103
+ base_values = []
104
+ value.each do |subvalue|
105
+ case subvalue
106
+ when Hash
107
+ process_parameters(subvalue, output, explanation: explanation, prefix: name)
108
+ else
109
+ base_values << subvalue
110
+ end
111
+ end
112
+ if base_values.any?
113
+ output[name] ||= explanation[name] || Parameter.new
114
+ output[name].value = [output[name].value, base_values.to_s].compact.join(", ")
115
+ end
116
+ else
117
+ output[name] ||= explanation[name] || Parameter.new
118
+ output[name].value = [output[name].value, value].compact.join(", ")
103
119
  end
104
120
  end
105
121
  if prefix.nil?
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module DocumentRequests
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
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.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Niv