washout_builder 0.15.4 → 0.15.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Appraisals +8 -8
- data/Rakefile +18 -2
- data/lib/washout_builder/document/complex_type.rb +1 -1
- data/lib/washout_builder/document/exception_model.rb +3 -3
- data/lib/washout_builder/version.rb +1 -1
- data/spec/app/controllers/washout_builder_controller_spec.rb +4 -4
- data/spec/app/helpers/washout_builder_complex_type_helper_spec.rb +4 -4
- data/spec/app/helpers/washout_builder_fault_type_helper_spec.rb +11 -11
- data/spec/app/helpers/washout_builder_method_arguments_helper_spec.rb +9 -9
- data/spec/app/helpers/washout_builder_method_list_helper_spec.rb +6 -6
- data/spec/app/helpers/washout_builder_method_return_type_helper_spec.rb +5 -5
- data/spec/dummy/config.ru +1 -1
- data/spec/lib/washout_builder/document/complex_type_spec.rb +22 -22
- data/spec/lib/washout_builder/document/exception_model_spec.rb +15 -15
- data/spec/lib/washout_builder/document/generator_spec.rb +20 -20
- data/spec/lib/washout_builder/type_spec.rb +4 -4
- data/spec/lib/washout_builder_spec.rb +69 -65
- data/spec/spec_helper.rb +7 -2
- data/spec/support/fix_minitest.rb +38 -0
- data/washout_builder.gemspec +18 -18
- metadata +89 -61
@@ -15,49 +15,49 @@ describe WashoutBuilder::Document::ExceptionModel do
|
|
15
15
|
[
|
16
16
|
WashoutBuilder::Document::SharedComplexType
|
17
17
|
].each do |extension|
|
18
|
-
specify { described_class.included_modules.
|
18
|
+
specify { expect(described_class.included_modules).to include(extension) }
|
19
19
|
end
|
20
20
|
|
21
|
-
specify { InheritedExceptionModel.included_modules.
|
21
|
+
specify { expect(InheritedExceptionModel.included_modules).to include(WashoutBuilder::Document::SharedComplexType) }
|
22
22
|
|
23
23
|
def fault_ancestor_hash(subject, structure, ancestors)
|
24
24
|
{ fault: subject, structure: structure, ancestors: ancestors }
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'gets the strcuture' do
|
28
|
-
subject.find_fault_model_structure.
|
28
|
+
expect(subject.find_fault_model_structure).to eq(structure)
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'gets the strcuture' do
|
32
|
-
base_exception.find_fault_model_structure.
|
32
|
+
expect(base_exception.find_fault_model_structure).to eq(base_structure)
|
33
33
|
end
|
34
34
|
it 'gets the strcuture' do
|
35
|
-
subject.find_fault_attributes.
|
35
|
+
expect(subject.find_fault_attributes).to eq(%w(message backtrace))
|
36
36
|
end
|
37
37
|
it 'gets the strcuture' do
|
38
|
-
base_exception.find_fault_attributes.
|
38
|
+
expect(base_exception.find_fault_attributes).to eq(%w(code message backtrace))
|
39
39
|
end
|
40
40
|
|
41
|
-
specify { subject.check_valid_fault_method?('code').
|
42
|
-
specify { subject.get_fault_type_method('code').
|
43
|
-
specify { subject.get_fault_type_method('message').
|
44
|
-
specify {
|
41
|
+
specify { expect(subject.check_valid_fault_method?('code')).to eq(true) }
|
42
|
+
specify { expect(subject.get_fault_type_method('code')).to eq('integer') }
|
43
|
+
specify { expect(subject.get_fault_type_method('message')).to eq('string') }
|
44
|
+
specify { expect(subject.get_fault_type_method('backtrace')).to eq('string') }
|
45
45
|
|
46
46
|
it 'gets the strcuture' do
|
47
|
-
|
47
|
+
expect(subject.remove_fault_type_inheritable_elements(['code'])).to eq('message' => { primitive: 'string', member_type: nil }, 'backtrace' => { primitive: 'string', member_type: nil })
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'fault_ancestor_hash' do
|
51
|
-
|
51
|
+
expect(subject.fault_ancestor_hash(structure, ancestors)).to eq(fault_ancestor_hash(subject, structure, ancestors))
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'gets the fault_ancestors' do
|
55
55
|
subject.expects(:get_complex_type_ancestors).with(subject, ['ActiveRecord::Base', 'Object', 'BasicObject', 'Exception']).returns(ancestors)
|
56
|
-
|
56
|
+
expect(subject.fault_ancestors).to eq ancestors
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'gets the attribute type' do
|
60
|
-
|
60
|
+
expect(subject.get_fault_type_method('some_name')).to eq 'string'
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'gets the fault_without_inheritable_elements' do
|
@@ -70,7 +70,7 @@ describe WashoutBuilder::Document::ExceptionModel do
|
|
70
70
|
subject.expects(:fault_ancestors).returns(nil)
|
71
71
|
subject.expects(:find_fault_model_structure).returns(structure)
|
72
72
|
subject.expects(:fault_ancestor_hash).with(structure, []).returns(fault_ancestor_hash(subject, structure, ancestors))
|
73
|
-
|
73
|
+
expect(subject.get_fault_class_ancestors([])).to eq(nil)
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'gets the ancestors' do
|
@@ -35,29 +35,29 @@ describe WashoutBuilder::Document::Generator do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
context 'namespace' do
|
38
|
-
specify { @document.namespace.
|
38
|
+
specify { expect(@document.namespace).to eq(soap_config.namespace) }
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'endpoint' do
|
42
|
-
specify {
|
42
|
+
specify { expect(@document.endpoint).to eq(soap_config.namespace.gsub('/wsdl', '/action')) }
|
43
43
|
end
|
44
44
|
|
45
45
|
context 'service' do
|
46
|
-
specify {
|
46
|
+
specify { expect(@document.service).to eq(service_class.name.underscore.gsub('_controller', '').camelize) }
|
47
47
|
end
|
48
48
|
|
49
49
|
context 'description' do
|
50
|
-
specify {
|
50
|
+
specify { expect(@document.service_description).to eq(soap_config.description) }
|
51
51
|
end
|
52
52
|
|
53
53
|
context 'operations' do
|
54
|
-
specify {
|
54
|
+
specify { expect(@document.operations).to eq(service_class.soap_actions.map { |operation, _formats| operation }) }
|
55
55
|
end
|
56
56
|
|
57
57
|
context 'sorted_operations' do
|
58
58
|
it 'returns sorted operations' do
|
59
59
|
expected = service_class.soap_actions.sort_by { |operation, _formats| operation.downcase }.uniq
|
60
|
-
|
60
|
+
expect(@document.sorted_operations).to eq expected
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -75,27 +75,27 @@ describe WashoutBuilder::Document::Generator do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
context 'input types' do
|
78
|
-
specify {
|
78
|
+
specify { expect(@document.input_types).to eq(argument_types('input')) }
|
79
79
|
end
|
80
80
|
|
81
81
|
context 'output types' do
|
82
|
-
specify {
|
82
|
+
specify { expect(@document.output_types).to eq(argument_types('output')) }
|
83
83
|
end
|
84
84
|
|
85
85
|
context 'operation exceptions' do
|
86
|
-
specify {
|
87
|
-
specify {
|
88
|
-
specify {
|
86
|
+
specify { expect(@document.operation_exceptions('dispatcher_method')).to eq([]) }
|
87
|
+
specify { expect(@document.operation_exceptions('dispatcher_method2')).to eq([WashoutBuilderTestError]) }
|
88
|
+
specify { expect(@document.operation_exceptions('dispatcher_method3')).to eq([WashoutBuilderTestError]) }
|
89
89
|
end
|
90
90
|
|
91
91
|
context 'all_soap_action_names' do
|
92
92
|
let(:expected) { service_class.soap_actions.map { |operation, _formats| operation }.map(&:to_s).sort_by(&:downcase).uniq }
|
93
93
|
|
94
|
-
specify {
|
94
|
+
specify { expect(@document.all_soap_action_names).to eq(expected) }
|
95
95
|
|
96
96
|
it 'returns nil on empty soap actions' do
|
97
97
|
@document.stubs(:soap_actions).returns(nil)
|
98
|
-
|
98
|
+
expect(@document.all_soap_action_names).to eq(nil)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -104,21 +104,21 @@ describe WashoutBuilder::Document::Generator do
|
|
104
104
|
let(:exceptions_raised) { actions_with_exceptions.map { |_operation, formats| formats[:raises].is_a?(Array) ? formats[:raises] : [formats[:raises]] }.flatten }
|
105
105
|
let(:filter_exceptions_raised) { exceptions_raised.select { |x| WashoutBuilder::Type.valid_fault_class?(x) } unless actions_with_exceptions.blank? }
|
106
106
|
|
107
|
-
specify {
|
108
|
-
specify {
|
109
|
-
specify {
|
107
|
+
specify { expect(@document.actions_with_exceptions).to eq actions_with_exceptions }
|
108
|
+
specify { expect(@document.exceptions_raised).to eq exceptions_raised }
|
109
|
+
specify { expect(@document.filter_exceptions_raised).to eq filter_exceptions_raised }
|
110
110
|
|
111
111
|
it 'returns the fault types' do
|
112
112
|
WashoutBuilder::Type.stubs(:all_fault_classes).returns([base_exception])
|
113
113
|
@document.expects(:get_complex_fault_types).with([base_exception]).returns([base_exception])
|
114
114
|
@document.expects(:sort_complex_types).with([base_exception], 'fault').returns([base_exception])
|
115
|
-
|
115
|
+
expect(@document.fault_types).to eq([base_exception])
|
116
116
|
end
|
117
117
|
|
118
118
|
it 'returns complex fault types' do
|
119
119
|
base_exception.expects(:get_fault_class_ancestors).with([], true).returns(nil)
|
120
120
|
@document.expects(:filter_exceptions_raised).returns(nil)
|
121
|
-
|
121
|
+
expect(@document.get_complex_fault_types([base_exception])).to eq([])
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -128,13 +128,13 @@ describe WashoutBuilder::Document::Generator do
|
|
128
128
|
|
129
129
|
it 'returns nil on empty soap actions' do
|
130
130
|
@document.stubs(:soap_actions).returns(nil)
|
131
|
-
|
131
|
+
expect(@document.complex_types).to eq(nil)
|
132
132
|
end
|
133
133
|
|
134
134
|
it 'returns nil if no complex types detected' do
|
135
135
|
WashOut::Param.any_instance.expects(:get_nested_complex_types).returns([])
|
136
136
|
@document.expects(:sort_complex_types).with([], 'class').returns(nil)
|
137
|
-
@document.complex_types.
|
137
|
+
expect( @document.complex_types).to eq(nil)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
@@ -7,11 +7,11 @@ describe WashoutBuilder::Type do
|
|
7
7
|
let(:fault_classes) { [exception] }
|
8
8
|
|
9
9
|
it 'defines a list of types' do
|
10
|
-
|
10
|
+
expect(WashoutBuilder::Type::BASIC_TYPES).to eq(%w(string integer double boolean date datetime float time int))
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'gets the fault classes defined' do
|
14
|
-
|
14
|
+
expect(WashoutBuilder::Type.all_fault_classes).to eq([base_exception])
|
15
15
|
end
|
16
16
|
|
17
17
|
context 'exception' do
|
@@ -20,11 +20,11 @@ describe WashoutBuilder::Type do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'checks if exception has ancestor' do
|
23
|
-
|
23
|
+
expect(WashoutBuilder::Type.ancestor_fault?(exception)).to eq(true)
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'checks if exception valid' do
|
27
|
-
|
27
|
+
expect(WashoutBuilder::Type.valid_fault_class?(exception)).to eq(true)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -36,19 +36,21 @@ describe WashoutBuilder do
|
|
36
36
|
|
37
37
|
describe 'Module' do
|
38
38
|
it 'includes' do
|
39
|
-
|
40
|
-
|
39
|
+
expect { lambda do
|
40
|
+
mock_controller do
|
41
41
|
# nothing
|
42
42
|
end
|
43
|
-
|
43
|
+
end
|
44
|
+
}.to_not raise_exception
|
44
45
|
end
|
45
46
|
|
46
47
|
it 'allows definition of a simple action' do
|
47
|
-
|
48
|
-
|
48
|
+
expect { lambda do
|
49
|
+
mock_controller do
|
49
50
|
soap_action 'answer', args: nil, return: :integer
|
50
51
|
end
|
51
|
-
|
52
|
+
end
|
53
|
+
}.to_not raise_exception
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
@@ -76,13 +78,13 @@ describe WashoutBuilder do
|
|
76
78
|
|
77
79
|
it 'lists operations' do
|
78
80
|
operations = xml[:definitions][:binding][:operation]
|
79
|
-
|
81
|
+
expect(operations).to be_a_kind_of(Array)
|
80
82
|
|
81
|
-
operations.map { |e| e[:'@name'] }.sort.
|
83
|
+
expect(operations.map { |e| e[:'@name'] }.sort ).to eq %w(Result getArea rocky).sort
|
82
84
|
end
|
83
85
|
|
84
86
|
it 'defines complex types' do
|
85
|
-
|
87
|
+
expect(wsdl.include?('<xsd:complexType name="Circle1">')).to eq true
|
86
88
|
end
|
87
89
|
|
88
90
|
it 'defines arrays' do
|
@@ -90,8 +92,8 @@ describe WashoutBuilder do
|
|
90
92
|
.find { |inneer_x| inneer_x[:'@name'] == 'Center' }[:sequence][:element]
|
91
93
|
.find { |inneer_x| inneer_x[:'@name'] == 'X' }
|
92
94
|
|
93
|
-
|
94
|
-
x[:'@max_occurs'].
|
95
|
+
expect(x[:'@min_occurs']).to eq('0')
|
96
|
+
expect(x[:'@max_occurs']).to eq('unbounded')
|
95
97
|
end
|
96
98
|
end
|
97
99
|
|
@@ -116,7 +118,7 @@ describe WashoutBuilder do
|
|
116
118
|
</env:Envelope>
|
117
119
|
XML
|
118
120
|
|
119
|
-
HTTPI.post('http://app/api/action', request).body.
|
121
|
+
expect( HTTPI.post('http://app/api/action', request).body).to eq( <<-XML
|
120
122
|
<?xml version="1.0" encoding="UTF-8"?>
|
121
123
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="false">
|
122
124
|
<soap:Body>
|
@@ -126,6 +128,7 @@ describe WashoutBuilder do
|
|
126
128
|
</soap:Body>
|
127
129
|
</soap:Envelope>
|
128
130
|
XML
|
131
|
+
)
|
129
132
|
end
|
130
133
|
|
131
134
|
it 'accept no parameters' do
|
@@ -136,8 +139,8 @@ describe WashoutBuilder do
|
|
136
139
|
end
|
137
140
|
end
|
138
141
|
|
139
|
-
|
140
|
-
.
|
142
|
+
expect(savon(:answer)[:answer_response][:value]
|
143
|
+
).to eq '42'
|
141
144
|
end
|
142
145
|
|
143
146
|
it 'accept insufficient parameters' do
|
@@ -148,8 +151,8 @@ describe WashoutBuilder do
|
|
148
151
|
end
|
149
152
|
end
|
150
153
|
|
151
|
-
|
152
|
-
.
|
154
|
+
expect(savon(:answer)[:answer_response][:value]
|
155
|
+
).to eq '42'
|
153
156
|
end
|
154
157
|
|
155
158
|
it 'accept empty parameter' do
|
@@ -159,8 +162,8 @@ describe WashoutBuilder do
|
|
159
162
|
render soap: { a: params[:a] }
|
160
163
|
end
|
161
164
|
end
|
162
|
-
|
163
|
-
.
|
165
|
+
expect(savon(:answer, a: '')[:answer_response][:a]
|
166
|
+
).to eq ({ :"@xsi:type" => 'xsd:string' })
|
164
167
|
end
|
165
168
|
|
166
169
|
it 'accept one parameter' do
|
@@ -171,8 +174,8 @@ describe WashoutBuilder do
|
|
171
174
|
end
|
172
175
|
end
|
173
176
|
|
174
|
-
|
175
|
-
|
177
|
+
expect(savon(:check_answer, 42)[:check_answer_response][:value]).to eq true
|
178
|
+
expect(savon(:check_answer, 13)[:check_answer_response][:value]).to eq false
|
176
179
|
end
|
177
180
|
|
178
181
|
it 'accept two parameters' do
|
@@ -183,7 +186,7 @@ describe WashoutBuilder do
|
|
183
186
|
end
|
184
187
|
end
|
185
188
|
|
186
|
-
|
189
|
+
expect(savon(:funky, a: 42, b: 'k')[:funky_response][:value]).to eq '420k'
|
187
190
|
end
|
188
191
|
end
|
189
192
|
|
@@ -206,8 +209,8 @@ describe WashoutBuilder do
|
|
206
209
|
message = { circle: { center: { x: 3, y: 4 },
|
207
210
|
radius: 5 } }
|
208
211
|
|
209
|
-
|
210
|
-
.
|
212
|
+
expect(savon(:find_area, message)[:find_area_response]
|
213
|
+
).to eq ({ area: (Math::PI * 25).to_s, distance_from_o: (5.0).to_s })
|
211
214
|
end
|
212
215
|
|
213
216
|
it 'accept arrays' do
|
@@ -297,8 +300,8 @@ describe WashoutBuilder do
|
|
297
300
|
end
|
298
301
|
end
|
299
302
|
|
300
|
-
|
301
|
-
.
|
303
|
+
expect(savon(:gogogo)[:gogogo_response]
|
304
|
+
).to eq ({ zoo: 'zoo', boo: { moo: 'moo', doo: 'doo', :"@xsi:type" => 'tns:Boo' } })
|
302
305
|
end
|
303
306
|
|
304
307
|
it 'respond with arrays' do
|
@@ -311,7 +314,7 @@ describe WashoutBuilder do
|
|
311
314
|
end
|
312
315
|
end
|
313
316
|
|
314
|
-
|
317
|
+
expect(savon(:rumba)[:rumba_response]).to eq ({ value: %w(1 2 3) })
|
315
318
|
end
|
316
319
|
|
317
320
|
it 'respond with complex structures inside arrays' do
|
@@ -330,12 +333,12 @@ describe WashoutBuilder do
|
|
330
333
|
end
|
331
334
|
end
|
332
335
|
|
333
|
-
|
336
|
+
expect(savon(:rumba)[:rumba_response]).to eq ({
|
334
337
|
rumbas: [
|
335
|
-
{ :
|
336
|
-
{ :
|
338
|
+
{ zombies: 'suck1', puppies: 'rock1', :"@xsi:type" => 'tns:Rumbas' },
|
339
|
+
{ zombies: 'suck2', puppies: 'rock2', :"@xsi:type" => 'tns:Rumbas' }
|
337
340
|
]
|
338
|
-
}
|
341
|
+
})
|
339
342
|
end
|
340
343
|
|
341
344
|
it 'respond with structs in structs in arrays' do
|
@@ -349,24 +352,24 @@ describe WashoutBuilder do
|
|
349
352
|
end
|
350
353
|
end
|
351
354
|
|
352
|
-
|
355
|
+
expect(savon(:rumba)[:rumba_response]).to eq ({
|
353
356
|
value: [
|
354
357
|
{
|
355
|
-
:
|
356
|
-
:
|
358
|
+
rumbas: {
|
359
|
+
zombies: '100000',
|
357
360
|
:"@xsi:type" => 'tns:Rumbas'
|
358
361
|
},
|
359
362
|
:"@xsi:type" => 'tns:Value'
|
360
363
|
},
|
361
364
|
{
|
362
|
-
:
|
363
|
-
:
|
364
|
-
:"@xsi:type"
|
365
|
+
rumbas: {
|
366
|
+
zombies: '2',
|
367
|
+
:"@xsi:type"=> 'tns:Rumbas'
|
365
368
|
},
|
366
|
-
:"@xsi:type"
|
369
|
+
:"@xsi:type"=> 'tns:Value'
|
367
370
|
}
|
368
371
|
]
|
369
|
-
}
|
372
|
+
})
|
370
373
|
end
|
371
374
|
|
372
375
|
context 'with arrays missing' do
|
@@ -379,7 +382,7 @@ describe WashoutBuilder do
|
|
379
382
|
end
|
380
383
|
end
|
381
384
|
|
382
|
-
savon(:rocknroll)[:rocknroll_response].
|
385
|
+
expect( savon(:rocknroll)[:rocknroll_response]).to be_nil
|
383
386
|
end
|
384
387
|
|
385
388
|
it 'respond with complext definition' do
|
@@ -391,7 +394,7 @@ describe WashoutBuilder do
|
|
391
394
|
end
|
392
395
|
end
|
393
396
|
|
394
|
-
|
397
|
+
expect(savon(:rocknroll)[:rocknroll_response]).to be_nil
|
395
398
|
end
|
396
399
|
|
397
400
|
it 'respond with nested simple definition' do
|
@@ -403,8 +406,8 @@ describe WashoutBuilder do
|
|
403
406
|
end
|
404
407
|
end
|
405
408
|
|
406
|
-
|
407
|
-
.
|
409
|
+
expect(savon(:rocknroll)[:rocknroll_response][:my_value]
|
410
|
+
).to eq ({ :"@xsi:type" => 'tns:MyValue' })
|
408
411
|
end
|
409
412
|
|
410
413
|
it 'handles incomplete array response' do
|
@@ -416,7 +419,7 @@ describe WashoutBuilder do
|
|
416
419
|
end
|
417
420
|
end
|
418
421
|
|
419
|
-
expect { savon(:rocknroll) }.
|
422
|
+
expect { savon(:rocknroll) }.to_not raise_error
|
420
423
|
end
|
421
424
|
end
|
422
425
|
end
|
@@ -447,26 +450,26 @@ describe WashoutBuilder do
|
|
447
450
|
mock_controller do
|
448
451
|
soap_action 'date', args: :date, return: :nil
|
449
452
|
def date
|
450
|
-
|
453
|
+
raise Exception if params[:value].present? && params[:value] != Date.parse('2000-12-30')
|
451
454
|
render soap: nil
|
452
455
|
end
|
453
456
|
end
|
454
457
|
|
455
458
|
savon(:date, value: '2000-12-30')
|
456
|
-
|
459
|
+
expect { savon(:date) }.not_to raise_exception
|
457
460
|
end
|
458
461
|
|
459
462
|
it 'recognize base64Binary' do
|
460
463
|
mock_controller do
|
461
464
|
soap_action 'base64', args: :base64Binary, return: :nil
|
462
465
|
def base64
|
463
|
-
params[:value].
|
466
|
+
raise Exception if params[:value].present? && params[:value] != 'test'
|
464
467
|
render soap: nil
|
465
468
|
end
|
466
469
|
end
|
467
470
|
|
468
471
|
savon(:base64, value: Base64.encode64('test'))
|
469
|
-
|
472
|
+
expect { savon(:base64) }.not_to raise_exception
|
470
473
|
end
|
471
474
|
end
|
472
475
|
|
@@ -481,9 +484,9 @@ describe WashoutBuilder do
|
|
481
484
|
end
|
482
485
|
end
|
483
486
|
|
484
|
-
|
487
|
+
expect {
|
485
488
|
savon(:duty, bad: 42, good: nil)
|
486
|
-
|
489
|
+
}.to raise_exception(Savon::SOAPFault)
|
487
490
|
end
|
488
491
|
|
489
492
|
it 'raise for date in incorrect format' do
|
@@ -493,9 +496,9 @@ describe WashoutBuilder do
|
|
493
496
|
render soap: nil
|
494
497
|
end
|
495
498
|
end
|
496
|
-
|
499
|
+
expect {
|
497
500
|
savon(:date, value: 'incorrect format')
|
498
|
-
|
501
|
+
}.to raise_exception(Savon::SOAPFault)
|
499
502
|
end
|
500
503
|
|
501
504
|
it 'raise to report SOAP errors', fails: true do
|
@@ -507,8 +510,8 @@ describe WashoutBuilder do
|
|
507
510
|
end
|
508
511
|
end
|
509
512
|
|
510
|
-
|
511
|
-
|
513
|
+
expect { savon(:error, need_error: false) }.not_to raise_exception
|
514
|
+
expect { savon(:error, need_error: true) }.to raise_exception(Savon::SOAPFault)
|
512
515
|
end
|
513
516
|
|
514
517
|
it 'raise for manual throws' do
|
@@ -519,7 +522,7 @@ describe WashoutBuilder do
|
|
519
522
|
end
|
520
523
|
end
|
521
524
|
|
522
|
-
|
525
|
+
expect { savon(:error) }.to raise_exception(Savon::SOAPFault)
|
523
526
|
end
|
524
527
|
|
525
528
|
it 'raise when response structure mismatches' do
|
@@ -552,12 +555,12 @@ describe WashoutBuilder do
|
|
552
555
|
end
|
553
556
|
end
|
554
557
|
|
555
|
-
|
558
|
+
expect { savon(:bad) }.to raise_exception(
|
556
559
|
WashOut::Dispatcher::ProgrammerError,
|
557
560
|
/SOAP response .*wyldness.*Array.*Hash.*stallion/
|
558
561
|
)
|
559
562
|
|
560
|
-
|
563
|
+
expect { savon(:bad2) }.to raise_exception(
|
561
564
|
WashOut::Dispatcher::ProgrammerError,
|
562
565
|
/SOAP response .*oops.*String.*telephone_booths.*Array/
|
563
566
|
)
|
@@ -581,10 +584,10 @@ describe WashoutBuilder do
|
|
581
584
|
end
|
582
585
|
end
|
583
586
|
|
584
|
-
|
587
|
+
expect { savon(:bad) }.to raise_exception{ |error|
|
585
588
|
error_hash = error.to_hash
|
586
|
-
|
587
|
-
|
589
|
+
expect(error_hash[:fault][:faultcode]).to eq(error_code.to_s)
|
590
|
+
expect(error_hash[:fault][:faultstring]).to eq(error_message)
|
588
591
|
expect(error).to be_a(Savon::SOAPFault)
|
589
592
|
}
|
590
593
|
end
|
@@ -597,15 +600,16 @@ describe WashoutBuilder do
|
|
597
600
|
raise_runtime_exception = raise_exception(RuntimeError)
|
598
601
|
|
599
602
|
mock_controller do
|
600
|
-
lambda do
|
601
603
|
soap_action 'rumba',
|
602
604
|
args: :integer,
|
603
|
-
return:
|
604
|
-
end.should raise_runtime_exception
|
605
|
+
return: nil
|
605
606
|
def rumba
|
607
|
+
raise RuntimeError
|
606
608
|
render soap: nil
|
607
609
|
end
|
608
610
|
end
|
611
|
+
|
612
|
+
expect { savon(:rumba) }.to raise_runtime_exception
|
609
613
|
end
|
610
614
|
end
|
611
615
|
|
@@ -619,8 +623,8 @@ describe WashoutBuilder do
|
|
619
623
|
end
|
620
624
|
end
|
621
625
|
|
622
|
-
savon(name.underscore.to_sym)["#{name.underscore}_response".to_sym][:value]
|
623
|
-
.
|
626
|
+
expect(savon(name.underscore.to_sym)["#{name.underscore}_response".to_sym][:value]
|
627
|
+
).to eq 'forty two'
|
624
628
|
end
|
625
629
|
|
626
630
|
it 'respects :response_tag option' do
|
@@ -631,7 +635,7 @@ describe WashoutBuilder do
|
|
631
635
|
end
|
632
636
|
end
|
633
637
|
|
634
|
-
|
638
|
+
expect(savon(:specific)).to eq({ test: { value: 'test' } })
|
635
639
|
end
|
636
640
|
|
637
641
|
it 'handles snakecase option properly' do
|