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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca7a49562654c7953fd102f99312b74884291311
4
- data.tar.gz: ca3c14e5bdbc4ca37b33f53c286ce011fd6f13cd
3
+ metadata.gz: 88b534c64a3563ba35ec771c7b97c2c63dd5b156
4
+ data.tar.gz: c721fb7c1109b795e493131bbba777d313f53272
5
5
  SHA512:
6
- metadata.gz: d1d1eec78f55e30ed89f11bcf5b3ce9503e833bec75cd8a790e6fdeb63e7b22532c99cba3fef45284124f12ad5d6c8b23c575e845ec74c1136416bdd2df646af
7
- data.tar.gz: dffb89120ce3dd8b65f2139ffc9e3067365d91c9ee4114a3a48c671716293108a742d9822eeca74a1c7c7ef49a60c4c290f390559629e4e106f37983011455f0
6
+ metadata.gz: b197f87137546b005140fcb642d2b4c24208119e5c38e0d49b09d1bc1a77a4039c7545ed1f746563423f750c2a99b31179a8794e69a99b92adc849dd70f6343e
7
+ data.tar.gz: a8f48288bf579a0104e4b1b754b38c0fca1822b90cc126047d2f6b3dc99f186f8ab38478b712229ad7d46cf0f5e7d6236dedac901c85c1ecb6d046f724832ee7
@@ -6,7 +6,7 @@ module WashoutBuilder # Returns the version of the currently loaded Rails as a <
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 15
9
- TINY = 7
9
+ TINY = 8
10
10
  PRE = nil
11
11
 
12
12
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
@@ -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("@xsi:type": 'xsd:string')
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
- ).to eq(zoo: 'zoo', boo: { moo: 'moo', doo: 'doo', "@xsi:type": 'tns:Boo' })
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]).to eq(rumbas: [
338
- { zombies: 'suck1', puppies: 'rock1', "@xsi:type": 'tns:Rumbas' },
339
- { zombies: 'suck2', puppies: 'rock2', "@xsi:type": 'tns:Rumbas' }
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]).to eq(value: [
358
+ expect(savon(:rumba)[:rumba_response].deep_include?(value: [
355
359
  {
356
360
  rumbas: {
357
- zombies: '100000',
358
- "@xsi:type": 'tns:Rumbas'
359
- },
360
- "@xsi:type": 'tns:Value'
361
+ zombies: '100000'
362
+ }
361
363
  },
362
364
  {
363
365
  rumbas: {
364
- zombies: '2',
365
- "@xsi:type": 'tns:Rumbas'
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: washout_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.7
4
+ version: 0.15.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada