washout_builder 0.15.5 → 0.15.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/Rakefile +3 -3
- data/lib/washout_builder/version.rb +1 -1
- data/spec/app/controllers/washout_builder_controller_spec.rb +1 -1
- data/spec/app/helpers/washout_builder_fault_type_helper_spec.rb +6 -6
- data/spec/lib/washout_builder/document/exception_model_spec.rb +5 -5
- data/spec/lib/washout_builder/document/generator_spec.rb +12 -12
- data/spec/lib/washout_builder/type_spec.rb +4 -4
- data/spec/lib/washout_builder_spec.rb +69 -73
- data/spec/spec_helper.rb +1 -1
- data/spec/support/fix_minitest.rb +4 -4
- 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: d919b2510e76675de1fff4f01f24054ea68a9523
|
4
|
+
data.tar.gz: 892e4bd42e766fd5aa745452e6fdaaa12b8578e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8c66851699a73fccfd5b3dfaa9eccb7fdcf183d7737a4992c28f95ceb63c6171c335d3f813116d1449fa0ad879d448d03715677086558e043ee5b10cb673c49
|
7
|
+
data.tar.gz: 8de3e81ba51afa325a7a351ece58bf389a1ec33eb2d42d99009964e0b9b726e7aa0e11a3cd0479e4a31f28dea5844fb6f490b8449cc582692320a1c1b7e28f34
|
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= washout_builder {<img src="https://badge.fury.io/rb/washout_builder.png" alt="Gem Version" />}[http://badge.fury.io/rb/washout_builder]
|
2
2
|
{<img src="https://travis-ci.org/bogdanRada/washout_builder.png?branch=master,develop" />}[https://travis-ci.org/bogdanRada/washout_builder]
|
3
|
-
{<img src="https://
|
3
|
+
{<img src="https://gemnasium.com/bogdanRada/washout_builder.svg" alt="Dependency Status" />}[https://gemnasium.com/bogdanRada/washout_builder]
|
4
4
|
{<img src="https://coveralls.io/repos/bogdanRada/washout_builder/badge.png?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/bogdanRada/washout_builder?branch=master]
|
5
5
|
{<img src="https://codeclimate.com/github/bogdanRada/washout_builder.png" />}[https://codeclimate.com/github/bogdanRada/washout_builder]
|
6
6
|
{<img src="https://reposs.herokuapp.com/?path=bogdanRada/washout_builder" alt="Repo Size"/>}[https://github.com/bogdanRada/washout_builder]
|
data/Rakefile
CHANGED
@@ -39,10 +39,10 @@ task default: [:all]
|
|
39
39
|
desc 'Test the plugin under all supported Rails versions.'
|
40
40
|
task :all do |_t|
|
41
41
|
if ENV['TRAVIS']
|
42
|
-
exec('
|
42
|
+
exec(' bundle exec appraisal install && bundle exec rake appraisal spec && bundle exec rake coveralls:push')
|
43
43
|
else
|
44
|
-
|
45
|
-
|
44
|
+
#exec(' bundle exec rubocop -a . && bundle exec phare &&')
|
45
|
+
exec ('bundle exec appraisal install && bundle exec rake appraisal spec')
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -43,6 +43,6 @@ describe WashoutBuilder::WashoutBuilderController, type: :controller do
|
|
43
43
|
controller.expects(:controller_is_a_service?).with(params[:name]).returns(route)
|
44
44
|
WashoutBuilder::Document::Generator.expects(:new).with(route.defaults[:controller])
|
45
45
|
get :all, params
|
46
|
-
|
46
|
+
expect(response).to render_template 'wash_with_html/doc'
|
47
47
|
end
|
48
48
|
end
|
@@ -46,7 +46,7 @@ describe WashoutBuilderFaultTypeHelper, type: :helper do
|
|
46
46
|
it 'returns false' do
|
47
47
|
attr_details = { primitive: 'STRING' }
|
48
48
|
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(attr_details[:primitive].to_s.downcase).returns(false)
|
49
|
-
|
49
|
+
expect(helper.primitive_type_is_basic?(attr_details)).to eq(false)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -54,14 +54,14 @@ describe WashoutBuilderFaultTypeHelper, type: :helper do
|
|
54
54
|
%w(NILCLASS nilclass).each do |primitive|
|
55
55
|
it 'returns string in case of nilclass' do
|
56
56
|
attr_details = { primitive: primitive }
|
57
|
-
|
57
|
+
expect(helper.get_primitive_type_string(attr_details)).to eq('string')
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
%w(BLA bla).each do |primitive|
|
62
62
|
it 'returns the primitive if not niclass' do
|
63
63
|
attr_details = { primitive: primitive }
|
64
|
-
|
64
|
+
expect(helper.get_primitive_type_string(attr_details)).to eq(primitive.to_s.downcase)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -71,14 +71,14 @@ describe WashoutBuilderFaultTypeHelper, type: :helper do
|
|
71
71
|
it 'checks the member type to be basic if primitive type array' do
|
72
72
|
attr_details = { primitive: primitive }
|
73
73
|
helper.expects(:member_type_is_basic?).with(attr_details).returns(true)
|
74
|
-
expect(helper.get_member_type_string(attr_details)
|
74
|
+
expect(helper.get_member_type_string(attr_details)).to eq(true)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
78
|
%w(BLA Bla bla).each do |primitive|
|
79
79
|
it 'returns the primitive type as it is if not array' do
|
80
80
|
attr_details = { primitive: primitive }
|
81
|
-
|
81
|
+
expect(helper.get_member_type_string(attr_details)).to eq(primitive)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
@@ -120,7 +120,7 @@ describe WashoutBuilderFaultTypeHelper, type: :helper do
|
|
120
120
|
helper.expects(:get_member_type_string).with(attr_details).returns(member_type)
|
121
121
|
helper.expects(:create_fault_model_complex_element_type).with(pre, member_type, attribute, true).returns(expected)
|
122
122
|
result = helper.create_html_fault_model_element_type(pre, attribute, attr_details)
|
123
|
-
|
123
|
+
expect(result).to eq(expected)
|
124
124
|
end
|
125
125
|
end
|
126
126
|
end
|
@@ -44,20 +44,20 @@ describe WashoutBuilder::Document::ExceptionModel do
|
|
44
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
|
@@ -39,25 +39,25 @@ describe WashoutBuilder::Document::Generator do
|
|
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,11 +75,11 @@ 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
|
@@ -95,7 +95,7 @@ describe WashoutBuilder::Document::Generator do
|
|
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
|
|
@@ -112,13 +112,13 @@ describe WashoutBuilder::Document::Generator 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
|
-
expect(
|
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,21 +36,23 @@ describe WashoutBuilder do
|
|
36
36
|
|
37
37
|
describe 'Module' do
|
38
38
|
it 'includes' do
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
expect do
|
40
|
+
lambda do
|
41
|
+
mock_controller do
|
42
|
+
# nothing
|
43
|
+
end
|
42
44
|
end
|
43
|
-
|
44
|
-
}.to_not raise_exception
|
45
|
+
end.to_not raise_exception
|
45
46
|
end
|
46
47
|
|
47
48
|
it 'allows definition of a simple action' do
|
48
|
-
|
49
|
-
|
50
|
-
|
49
|
+
expect do
|
50
|
+
lambda do
|
51
|
+
mock_controller do
|
52
|
+
soap_action 'answer', args: nil, return: :integer
|
53
|
+
end
|
51
54
|
end
|
52
|
-
|
53
|
-
}.to_not raise_exception
|
55
|
+
end.to_not raise_exception
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
@@ -78,13 +80,13 @@ describe WashoutBuilder do
|
|
78
80
|
|
79
81
|
it 'lists operations' do
|
80
82
|
operations = xml[:definitions][:binding][:operation]
|
81
|
-
|
83
|
+
expect(operations).to be_a_kind_of(Array)
|
82
84
|
|
83
|
-
expect(operations.map { |e| e[:'@name'] }.sort
|
85
|
+
expect(operations.map { |e| e[:'@name'] }.sort).to eq %w(Result getArea rocky).sort
|
84
86
|
end
|
85
87
|
|
86
88
|
it 'defines complex types' do
|
87
|
-
|
89
|
+
expect(wsdl.include?('<xsd:complexType name="Circle1">')).to eq true
|
88
90
|
end
|
89
91
|
|
90
92
|
it 'defines arrays' do
|
@@ -92,7 +94,7 @@ describe WashoutBuilder do
|
|
92
94
|
.find { |inneer_x| inneer_x[:'@name'] == 'Center' }[:sequence][:element]
|
93
95
|
.find { |inneer_x| inneer_x[:'@name'] == 'X' }
|
94
96
|
|
95
|
-
|
97
|
+
expect(x[:'@min_occurs']).to eq('0')
|
96
98
|
expect(x[:'@max_occurs']).to eq('unbounded')
|
97
99
|
end
|
98
100
|
end
|
@@ -118,7 +120,7 @@ describe WashoutBuilder do
|
|
118
120
|
</env:Envelope>
|
119
121
|
XML
|
120
122
|
|
121
|
-
expect(
|
123
|
+
expect(HTTPI.post('http://app/api/action', request).body).to eq(<<-XML
|
122
124
|
<?xml version="1.0" encoding="UTF-8"?>
|
123
125
|
<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">
|
124
126
|
<soap:Body>
|
@@ -128,7 +130,7 @@ describe WashoutBuilder do
|
|
128
130
|
</soap:Body>
|
129
131
|
</soap:Envelope>
|
130
132
|
XML
|
131
|
-
|
133
|
+
)
|
132
134
|
end
|
133
135
|
|
134
136
|
it 'accept no parameters' do
|
@@ -139,8 +141,8 @@ describe WashoutBuilder do
|
|
139
141
|
end
|
140
142
|
end
|
141
143
|
|
142
|
-
|
143
|
-
|
144
|
+
expect(savon(:answer)[:answer_response][:value]
|
145
|
+
).to eq '42'
|
144
146
|
end
|
145
147
|
|
146
148
|
it 'accept insufficient parameters' do
|
@@ -151,8 +153,8 @@ describe WashoutBuilder do
|
|
151
153
|
end
|
152
154
|
end
|
153
155
|
|
154
|
-
|
155
|
-
|
156
|
+
expect(savon(:answer)[:answer_response][:value]
|
157
|
+
).to eq '42'
|
156
158
|
end
|
157
159
|
|
158
160
|
it 'accept empty parameter' do
|
@@ -162,8 +164,7 @@ describe WashoutBuilder do
|
|
162
164
|
render soap: { a: params[:a] }
|
163
165
|
end
|
164
166
|
end
|
165
|
-
|
166
|
-
).to eq ({ :"@xsi:type" => 'xsd:string' })
|
167
|
+
expect(savon(:answer, a: '')[:answer_response][:a]).to eq("@xsi:type": 'xsd:string')
|
167
168
|
end
|
168
169
|
|
169
170
|
it 'accept one parameter' do
|
@@ -174,8 +175,8 @@ describe WashoutBuilder do
|
|
174
175
|
end
|
175
176
|
end
|
176
177
|
|
177
|
-
|
178
|
-
|
178
|
+
expect(savon(:check_answer, 42)[:check_answer_response][:value]).to eq true
|
179
|
+
expect(savon(:check_answer, 13)[:check_answer_response][:value]).to eq false
|
179
180
|
end
|
180
181
|
|
181
182
|
it 'accept two parameters' do
|
@@ -186,7 +187,7 @@ describe WashoutBuilder do
|
|
186
187
|
end
|
187
188
|
end
|
188
189
|
|
189
|
-
|
190
|
+
expect(savon(:funky, a: 42, b: 'k')[:funky_response][:value]).to eq '420k'
|
190
191
|
end
|
191
192
|
end
|
192
193
|
|
@@ -209,8 +210,8 @@ describe WashoutBuilder do
|
|
209
210
|
message = { circle: { center: { x: 3, y: 4 },
|
210
211
|
radius: 5 } }
|
211
212
|
|
212
|
-
|
213
|
-
|
213
|
+
expect(savon(:find_area, message)[:find_area_response]
|
214
|
+
).to eq(area: (Math::PI * 25).to_s, distance_from_o: (5.0).to_s)
|
214
215
|
end
|
215
216
|
|
216
217
|
it 'accept arrays' do
|
@@ -300,8 +301,8 @@ describe WashoutBuilder do
|
|
300
301
|
end
|
301
302
|
end
|
302
303
|
|
303
|
-
|
304
|
-
|
304
|
+
expect(savon(:gogogo)[:gogogo_response]
|
305
|
+
).to eq(zoo: 'zoo', boo: { moo: 'moo', doo: 'doo', "@xsi:type": 'tns:Boo' })
|
305
306
|
end
|
306
307
|
|
307
308
|
it 'respond with arrays' do
|
@@ -314,7 +315,7 @@ describe WashoutBuilder do
|
|
314
315
|
end
|
315
316
|
end
|
316
317
|
|
317
|
-
|
318
|
+
expect(savon(:rumba)[:rumba_response]).to eq(value: %w(1 2 3))
|
318
319
|
end
|
319
320
|
|
320
321
|
it 'respond with complex structures inside arrays' do
|
@@ -333,12 +334,10 @@ describe WashoutBuilder do
|
|
333
334
|
end
|
334
335
|
end
|
335
336
|
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
]
|
341
|
-
})
|
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
|
+
])
|
342
341
|
end
|
343
342
|
|
344
343
|
it 'respond with structs in structs in arrays' do
|
@@ -352,24 +351,22 @@ describe WashoutBuilder do
|
|
352
351
|
end
|
353
352
|
end
|
354
353
|
|
355
|
-
|
356
|
-
|
357
|
-
{
|
358
|
-
|
359
|
-
|
360
|
-
:"@xsi:type" => 'tns:Rumbas'
|
361
|
-
},
|
362
|
-
:"@xsi:type" => 'tns:Value'
|
354
|
+
expect(savon(:rumba)[:rumba_response]).to eq(value: [
|
355
|
+
{
|
356
|
+
rumbas: {
|
357
|
+
zombies: '100000',
|
358
|
+
"@xsi:type": 'tns:Rumbas'
|
363
359
|
},
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
}
|
371
|
-
|
372
|
-
|
360
|
+
"@xsi:type": 'tns:Value'
|
361
|
+
},
|
362
|
+
{
|
363
|
+
rumbas: {
|
364
|
+
zombies: '2',
|
365
|
+
"@xsi:type": 'tns:Rumbas'
|
366
|
+
},
|
367
|
+
"@xsi:type": 'tns:Value'
|
368
|
+
}
|
369
|
+
])
|
373
370
|
end
|
374
371
|
|
375
372
|
context 'with arrays missing' do
|
@@ -382,7 +379,7 @@ describe WashoutBuilder do
|
|
382
379
|
end
|
383
380
|
end
|
384
381
|
|
385
|
-
expect(
|
382
|
+
expect(savon(:rocknroll)[:rocknroll_response]).to be_nil
|
386
383
|
end
|
387
384
|
|
388
385
|
it 'respond with complext definition' do
|
@@ -394,7 +391,7 @@ describe WashoutBuilder do
|
|
394
391
|
end
|
395
392
|
end
|
396
393
|
|
397
|
-
|
394
|
+
expect(savon(:rocknroll)[:rocknroll_response]).to be_nil
|
398
395
|
end
|
399
396
|
|
400
397
|
it 'respond with nested simple definition' do
|
@@ -406,8 +403,8 @@ describe WashoutBuilder do
|
|
406
403
|
end
|
407
404
|
end
|
408
405
|
|
409
|
-
|
410
|
-
|
406
|
+
expect(savon(:rocknroll)[:rocknroll_response][:my_value]
|
407
|
+
).to eq("@xsi:type": 'tns:MyValue')
|
411
408
|
end
|
412
409
|
|
413
410
|
it 'handles incomplete array response' do
|
@@ -450,7 +447,7 @@ describe WashoutBuilder do
|
|
450
447
|
mock_controller do
|
451
448
|
soap_action 'date', args: :date, return: :nil
|
452
449
|
def date
|
453
|
-
|
450
|
+
raise Exception if params[:value].present? && params[:value] != Date.parse('2000-12-30')
|
454
451
|
render soap: nil
|
455
452
|
end
|
456
453
|
end
|
@@ -463,7 +460,7 @@ describe WashoutBuilder do
|
|
463
460
|
mock_controller do
|
464
461
|
soap_action 'base64', args: :base64Binary, return: :nil
|
465
462
|
def base64
|
466
|
-
raise Exception if
|
463
|
+
raise Exception if params[:value].present? && params[:value] != 'test'
|
467
464
|
render soap: nil
|
468
465
|
end
|
469
466
|
end
|
@@ -484,9 +481,9 @@ describe WashoutBuilder do
|
|
484
481
|
end
|
485
482
|
end
|
486
483
|
|
487
|
-
|
484
|
+
expect do
|
488
485
|
savon(:duty, bad: 42, good: nil)
|
489
|
-
|
486
|
+
end.to raise_exception(Savon::SOAPFault)
|
490
487
|
end
|
491
488
|
|
492
489
|
it 'raise for date in incorrect format' do
|
@@ -496,9 +493,9 @@ describe WashoutBuilder do
|
|
496
493
|
render soap: nil
|
497
494
|
end
|
498
495
|
end
|
499
|
-
expect
|
496
|
+
expect do
|
500
497
|
savon(:date, value: 'incorrect format')
|
501
|
-
|
498
|
+
end.to raise_exception(Savon::SOAPFault)
|
502
499
|
end
|
503
500
|
|
504
501
|
it 'raise to report SOAP errors', fails: true do
|
@@ -586,8 +583,8 @@ describe WashoutBuilder do
|
|
586
583
|
|
587
584
|
expect { savon(:bad) }.to raise_exception{ |error|
|
588
585
|
error_hash = error.to_hash
|
589
|
-
|
590
|
-
|
586
|
+
expect(error_hash[:fault][:faultcode]).to eq(error_code.to_s)
|
587
|
+
expect(error_hash[:fault][:faultstring]).to eq(error_message)
|
591
588
|
expect(error).to be_a(Savon::SOAPFault)
|
592
589
|
}
|
593
590
|
end
|
@@ -600,16 +597,15 @@ describe WashoutBuilder do
|
|
600
597
|
raise_runtime_exception = raise_exception(RuntimeError)
|
601
598
|
|
602
599
|
mock_controller do
|
603
|
-
|
604
|
-
|
605
|
-
|
600
|
+
soap_action 'rumba',
|
601
|
+
args: :integer,
|
602
|
+
return: nil
|
606
603
|
def rumba
|
607
604
|
raise RuntimeError
|
608
|
-
render soap: nil
|
609
605
|
end
|
610
606
|
end
|
611
|
-
|
612
|
-
|
607
|
+
|
608
|
+
expect { savon(:rumba) }.to raise_runtime_exception
|
613
609
|
end
|
614
610
|
end
|
615
611
|
|
@@ -624,7 +620,7 @@ describe WashoutBuilder do
|
|
624
620
|
end
|
625
621
|
|
626
622
|
expect(savon(name.underscore.to_sym)["#{name.underscore}_response".to_sym][:value]
|
627
|
-
|
623
|
+
).to eq 'forty two'
|
628
624
|
end
|
629
625
|
|
630
626
|
it 'respects :response_tag option' do
|
@@ -635,7 +631,7 @@ describe WashoutBuilder do
|
|
635
631
|
end
|
636
632
|
end
|
637
633
|
|
638
|
-
|
634
|
+
expect(savon(:specific)).to eq(test: { value: 'test' })
|
639
635
|
end
|
640
636
|
|
641
637
|
it 'handles snakecase option properly' do
|
data/spec/spec_helper.rb
CHANGED
@@ -6,16 +6,16 @@ module FIxMinitest
|
|
6
6
|
override_minitest_unit_run
|
7
7
|
end
|
8
8
|
|
9
|
-
# rubocop:disable
|
9
|
+
# rubocop:disable all
|
10
10
|
def self.override_minitest_run
|
11
11
|
Minitest.instance_eval do
|
12
12
|
def run(*)
|
13
13
|
FIxMinitest.run_mininitest
|
14
|
-
end
|
14
|
+
end
|
15
15
|
end if defined?(Minitest)
|
16
16
|
end
|
17
|
-
|
18
|
-
# rubocop:disable NestedMethodDefinition
|
17
|
+
|
18
|
+
# rubocop:disable NestedMethodDefinition
|
19
19
|
def self.run_mininitest
|
20
20
|
case $ERROR_INFO
|
21
21
|
when SystemExit
|