washout_builder 0.15.7 → 0.15.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/washout_builder/version.rb +1 -1
- data/spec/lib/washout_builder_spec.rb +24 -19
- data/spec/spec_helper.rb +28 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88b534c64a3563ba35ec771c7b97c2c63dd5b156
|
4
|
+
data.tar.gz: c721fb7c1109b795e493131bbba777d313f53272
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b197f87137546b005140fcb642d2b4c24208119e5c38e0d49b09d1bc1a77a4039c7545ed1f746563423f750c2a99b31179a8794e69a99b92adc849dd70f6343e
|
7
|
+
data.tar.gz: a8f48288bf579a0104e4b1b754b38c0fca1822b90cc126047d2f6b3dc99f186f8ab38478b712229ad7d46cf0f5e7d6236dedac901c85c1ecb6d046f724832ee7
|
@@ -164,7 +164,7 @@ describe WashoutBuilder do
|
|
164
164
|
render soap: { a: params[:a] }
|
165
165
|
end
|
166
166
|
end
|
167
|
-
expect(savon(:answer, a: '')[:answer_response][:a]).to eq(
|
167
|
+
expect(savon(:answer, a: '')[:answer_response][:a][:'@xsi:type']).to eq('xsd:string')
|
168
168
|
end
|
169
169
|
|
170
170
|
it 'accept one parameter' do
|
@@ -301,8 +301,9 @@ describe WashoutBuilder do
|
|
301
301
|
end
|
302
302
|
end
|
303
303
|
|
304
|
-
expect(savon(:gogogo)[:gogogo_response]
|
305
|
-
|
304
|
+
expect(savon(:gogogo)[:gogogo_response].deep_include?(zoo: 'zoo', boo: { moo: 'moo', doo: 'doo' })).to eq true
|
305
|
+
|
306
|
+
expect(savon(:gogogo)[:gogogo_response][:boo][:'@xsi:type']).to eq('tns:Boo')
|
306
307
|
end
|
307
308
|
|
308
309
|
it 'respond with arrays' do
|
@@ -334,10 +335,13 @@ describe WashoutBuilder do
|
|
334
335
|
end
|
335
336
|
end
|
336
337
|
|
337
|
-
expect(savon(:rumba)[:rumba_response]
|
338
|
-
{ zombies: 'suck1', puppies: 'rock1'
|
339
|
-
{ zombies: 'suck2', puppies: 'rock2'
|
340
|
-
])
|
338
|
+
expect(savon(:rumba)[:rumba_response].deep_include?(rumbas: [
|
339
|
+
{ zombies: 'suck1', puppies: 'rock1' },
|
340
|
+
{ zombies: 'suck2', puppies: 'rock2' }
|
341
|
+
])).to eq(true)
|
342
|
+
|
343
|
+
expect(savon(:rumba)[:rumba_response][:rumbas][0][:'@xsi:type']).to eq('tns:Rumbas')
|
344
|
+
expect(savon(:rumba)[:rumba_response][:rumbas][1][:'@xsi:type']).to eq('tns:Rumbas')
|
341
345
|
end
|
342
346
|
|
343
347
|
it 'respond with structs in structs in arrays' do
|
@@ -351,22 +355,24 @@ describe WashoutBuilder do
|
|
351
355
|
end
|
352
356
|
end
|
353
357
|
|
354
|
-
expect(savon(:rumba)[:rumba_response]
|
358
|
+
expect(savon(:rumba)[:rumba_response].deep_include?(value: [
|
355
359
|
{
|
356
360
|
rumbas: {
|
357
|
-
zombies: '100000'
|
358
|
-
|
359
|
-
},
|
360
|
-
"@xsi:type": 'tns:Value'
|
361
|
+
zombies: '100000'
|
362
|
+
}
|
361
363
|
},
|
362
364
|
{
|
363
365
|
rumbas: {
|
364
|
-
zombies: '2'
|
365
|
-
|
366
|
-
},
|
367
|
-
"@xsi:type": 'tns:Value'
|
366
|
+
zombies: '2'
|
367
|
+
}
|
368
368
|
}
|
369
|
-
])
|
369
|
+
])).to eq(true)
|
370
|
+
|
371
|
+
expect(savon(:rumba)[:rumba_response][:value][0][:'@xsi:type']).to eq('tns:Value')
|
372
|
+
expect(savon(:rumba)[:rumba_response][:value][1][:'@xsi:type']).to eq('tns:Value')
|
373
|
+
|
374
|
+
expect(savon(:rumba)[:rumba_response][:value][0][:rumbas][:'@xsi:type']).to eq('tns:Rumbas')
|
375
|
+
expect(savon(:rumba)[:rumba_response][:value][1][:rumbas][:'@xsi:type']).to eq('tns:Rumbas')
|
370
376
|
end
|
371
377
|
|
372
378
|
context 'with arrays missing' do
|
@@ -403,8 +409,7 @@ describe WashoutBuilder do
|
|
403
409
|
end
|
404
410
|
end
|
405
411
|
|
406
|
-
expect(savon(:rocknroll)[:rocknroll_response][:my_value]
|
407
|
-
).to eq("@xsi:type": 'tns:MyValue')
|
412
|
+
expect(savon(:rocknroll)[:rocknroll_response][:my_value][:'@xsi:type']).to eq('tns:MyValue')
|
408
413
|
end
|
409
414
|
|
410
415
|
it 'handles incomplete array response' do
|
data/spec/spec_helper.rb
CHANGED
@@ -116,3 +116,31 @@ def get_wash_out_param(class_name_or_structure, soap_config = OpenStruct.new(
|
|
116
116
|
))
|
117
117
|
WashOut::Param.parse_builder_def(soap_config, class_name_or_structure)[0]
|
118
118
|
end
|
119
|
+
|
120
|
+
class Hash
|
121
|
+
def deep_include?(sub_hash)
|
122
|
+
sub_hash.keys.all? do |key|
|
123
|
+
if check_key_type(key, Hash)
|
124
|
+
sub_hash[key].is_a?(Hash) && self[key].deep_include?(sub_hash[key])
|
125
|
+
elsif check_key_type(key, Array)
|
126
|
+
sub_hash[key].is_a?(Array) && deep_include_array(key, sub_hash)
|
127
|
+
else
|
128
|
+
self[key] == sub_hash[key]
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def check_key_type(key, type)
|
134
|
+
self.key?(key) && self[key].is_a?(type)
|
135
|
+
end
|
136
|
+
|
137
|
+
def deep_include_array(key, sub_hash)
|
138
|
+
self[key].each_with_index do |value, index|
|
139
|
+
if value.is_a?(Hash)
|
140
|
+
value.deep_include?(sub_hash[key][index])
|
141
|
+
else
|
142
|
+
value == sub_hash[key][index]
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|