akamai_api 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Guardfile +24 -0
- data/README.md +3 -0
- data/akamai_api.gemspec +4 -3
- data/lib/akamai_api/ccu.rb +60 -52
- data/lib/akamai_api/cp_code.rb +12 -7
- data/lib/akamai_api/eccu_request.rb +70 -62
- data/lib/akamai_api/soap_body.rb +15 -27
- data/lib/akamai_api/version.rb +1 -1
- data/lib/akamai_api.rb +1 -1
- data/spec/fixtures/{purge_request/success.xml → ccu/successful_purge.xml} +0 -0
- data/spec/fixtures/{get_cp_codes/sample.xml → cp_code/collection.xml} +0 -0
- data/spec/fixtures/{get_cp_codes/sample_one_item.xml → cp_code/single.xml} +0 -0
- data/spec/fixtures/{delete/success.xml → eccu/delete/successful.xml} +0 -0
- data/spec/fixtures/{get_ids/success.xml → eccu/get_ids/successful.xml} +0 -0
- data/spec/fixtures/{get_info/success.xml → eccu/get_info/successful.xml} +0 -0
- data/spec/fixtures/{set_notes/success.xml → eccu/set_notes/successful.xml} +0 -0
- data/spec/fixtures/eccu/set_status_change_email/fault.xml +8 -0
- data/spec/fixtures/{set_status_change_email/success.xml → eccu/set_status_change_email/successful.xml} +0 -0
- data/spec/fixtures/{upload → eccu/upload}/fault.xml +0 -0
- data/spec/fixtures/{upload/success.xml → eccu/upload/successful.xml} +0 -0
- data/spec/lib/akamai_api/ccu_spec.rb +24 -74
- data/spec/lib/akamai_api/cp_code_spec.rb +30 -26
- data/spec/lib/akamai_api/eccu_request_spec.rb +84 -46
- data/spec/lib/akamai_api/soap_body_spec.rb +10 -13
- data/spec/spec_helper.rb +7 -3
- data/spec/support/savon_backports.rb +10 -0
- data/wsdls/cpcode.wsdl +2765 -0
- data/wsdls/eccu.wsdl +584 -0
- metadata +36 -31
- data/spec/support/savon_tester.rb +0 -16
@@ -2,14 +2,31 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module AkamaiApi
|
4
4
|
describe Ccu do
|
5
|
-
include
|
6
|
-
|
7
|
-
before
|
8
|
-
|
9
|
-
|
5
|
+
include Savon::SpecHelper
|
6
|
+
|
7
|
+
before(:all) { savon.mock! }
|
8
|
+
after(:all) { savon.unmock! }
|
9
|
+
|
10
|
+
let(:fixture) { File.read 'spec/fixtures/ccu/successful_purge.xml' }
|
11
|
+
|
12
|
+
def soap_body method, *uris
|
13
|
+
method_parts = method.split('_')
|
14
|
+
options = ["action=#{method_parts.first}", "type=#{method_parts.last}"]
|
15
|
+
SoapBody.new do
|
16
|
+
string :name, AkamaiApi.config[:auth].first
|
17
|
+
string :pwd, AkamaiApi.config[:auth].last
|
18
|
+
string :network, ''
|
19
|
+
array :opt, options
|
20
|
+
array :uri, uris
|
21
|
+
end
|
10
22
|
end
|
11
23
|
|
12
24
|
shared_examples 'purge helper' do
|
25
|
+
before do
|
26
|
+
body = soap_body(method, '12345').to_s
|
27
|
+
savon.expects(:purge_request).with(:message => body).returns(fixture)
|
28
|
+
end
|
29
|
+
|
13
30
|
it 'responds with a CcuResponse object' do
|
14
31
|
Ccu.send(method, '12345').should be_a CcuResponse
|
15
32
|
end
|
@@ -55,83 +72,16 @@ module AkamaiApi
|
|
55
72
|
|
56
73
|
describe '#purge raises an error when' do
|
57
74
|
it 'action is not allowed' do
|
58
|
-
|
59
|
-
expect {
|
60
|
-
Ccu.purge action, :cpcode, '1234'
|
61
|
-
}.to_not raise_error
|
62
|
-
end
|
63
|
-
expect { Ccu.purge :sss, :cpcode, '12345' }.to raise_error
|
75
|
+
expect { Ccu.purge :sss, :cpcode, '12345' }.to raise_error Ccu::UnrecognizedOption
|
64
76
|
end
|
65
77
|
|
66
78
|
it 'type is not allowed' do
|
67
|
-
|
68
|
-
expect {
|
69
|
-
Ccu.purge :remove, type, '12345'
|
70
|
-
}.to_not raise_error
|
71
|
-
end
|
72
|
-
expect { Ccu.purge :remove, :foo, '12345' }.to raise_error
|
79
|
+
expect { Ccu.purge :remove, :foo, '12345' }.to raise_error Ccu::UnrecognizedOption
|
73
80
|
end
|
74
81
|
|
75
82
|
it 'domain is specified and not allowed' do
|
76
|
-
%w(production staging).each do |domain|
|
77
|
-
expect { Ccu.purge :remove, :arl, 'foo', :domain => domain }.to_not raise_error
|
78
|
-
end
|
79
83
|
expect { Ccu.purge :remove, :arl, 'foo', :domain => :foo }.to raise_error
|
80
84
|
end
|
81
85
|
end
|
82
|
-
|
83
|
-
describe '#purge request arguments' do
|
84
|
-
it 'should include user and password' do
|
85
|
-
soap_body = SoapBody.any_instance
|
86
|
-
soap_body.stub :string => ''
|
87
|
-
soap_body.should_receive(:string).with :name, AkamaiApi.config[:auth].first
|
88
|
-
soap_body.should_receive(:string).with :pwd, AkamaiApi.config[:auth].last
|
89
|
-
Ccu.purge :remove, :arl, 'foo'
|
90
|
-
end
|
91
|
-
|
92
|
-
describe 'options' do
|
93
|
-
before { SoapBody.any_instance.stub :array => '' }
|
94
|
-
|
95
|
-
it 'include action and type' do
|
96
|
-
SoapBody.any_instance.should_receive(:array).with(:opt, kind_of(Array)) do |name, array|
|
97
|
-
array.should include 'type=arl'
|
98
|
-
array.should include 'action=remove'
|
99
|
-
end
|
100
|
-
Ccu.purge :remove, :arl, 'foo'
|
101
|
-
end
|
102
|
-
|
103
|
-
describe 'domain' do
|
104
|
-
it 'is not included by default' do
|
105
|
-
SoapBody.any_instance.should_receive(:array).with(:opt, kind_of(Array)) do |name, array|
|
106
|
-
array.detect { |s| s =~ /^domain/ }.should be_nil
|
107
|
-
end
|
108
|
-
Ccu.purge :remove, :arl, 'foo'
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'is included if specified' do
|
112
|
-
SoapBody.any_instance.should_receive(:array).with(:opt, kind_of(Array)) do |name, array|
|
113
|
-
array.should include 'domain=production'
|
114
|
-
end
|
115
|
-
Ccu.purge :remove, :arl, 'foo', :domain => 'production'
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
describe 'email' do
|
120
|
-
it 'is not included by default' do
|
121
|
-
SoapBody.any_instance.should_receive(:array).with(:opt, kind_of(Array)) do |name, array|
|
122
|
-
array.detect { |s| s =~ /^email/ }.should be_nil
|
123
|
-
end
|
124
|
-
Ccu.purge :remove, :arl, 'foo'
|
125
|
-
end
|
126
|
-
|
127
|
-
it 'is included if specified' do
|
128
|
-
SoapBody.any_instance.should_receive(:array).with(:opt, kind_of(Array)) do |name, array|
|
129
|
-
array.should include 'email-notification=foo@foo.com,pip@pip.com'
|
130
|
-
end
|
131
|
-
Ccu.purge :remove, :arl, 'foo', :email => ['foo@foo.com', 'pip@pip.com']
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
86
|
end
|
137
87
|
end
|
@@ -1,42 +1,46 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
include SavonTester
|
3
|
+
describe AkamaiApi::CpCode do
|
4
|
+
include Savon::SpecHelper
|
6
5
|
|
7
|
-
|
6
|
+
before(:all) { savon.mock! }
|
7
|
+
after(:all) { savon.unmock! }
|
8
|
+
|
9
|
+
describe '::all' do
|
10
|
+
context 'when there are multiple cp codes' do
|
8
11
|
before do
|
9
|
-
|
10
|
-
|
12
|
+
fixture = File.read 'spec/fixtures/cp_code/collection.xml'
|
13
|
+
savon.expects(:get_cp_codes).returns(fixture)
|
11
14
|
end
|
12
15
|
|
13
|
-
it '
|
14
|
-
CpCode.all.each { |o| o.should be_a CpCode }
|
16
|
+
it 'returns a collection of cp codes' do
|
17
|
+
AkamaiApi::CpCode.all.each { |o| o.should be_a AkamaiApi::CpCode }
|
15
18
|
end
|
16
19
|
|
17
|
-
it '
|
18
|
-
CpCode.all.count.should == 2
|
20
|
+
it 'returns a collection with the correct size' do
|
21
|
+
AkamaiApi::CpCode.all.count.should == 2
|
22
|
+
end
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
it 'correctly fills each cp code object' do
|
25
|
+
first = AkamaiApi::CpCode.all.first
|
26
|
+
first.code.should == '12345'
|
27
|
+
first.description.should == 'Foo Site'
|
28
|
+
first.service.should == 'Site_Accel::Site_Accel'
|
24
29
|
end
|
30
|
+
end
|
25
31
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
32
|
+
context 'when there is only one cp code' do
|
33
|
+
before do
|
34
|
+
fixture = File.read 'spec/fixtures/cp_code/single.xml'
|
35
|
+
savon.expects(:get_cp_codes).returns(fixture)
|
36
|
+
end
|
31
37
|
|
32
|
-
|
33
|
-
|
38
|
+
it 'returns a collection of cp codes' do
|
39
|
+
AkamaiApi::CpCode.all.each { |o| o.should be_a AkamaiApi::CpCode }
|
40
|
+
end
|
34
41
|
|
35
|
-
|
36
|
-
|
37
|
-
model.description.should == 'Foo Site'
|
38
|
-
model.service.should == 'Site_Accel::Site_Accel'
|
39
|
-
end
|
42
|
+
it 'returns a collection with the correct size' do
|
43
|
+
AkamaiApi::CpCode.all.count.should == 1
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
@@ -2,12 +2,16 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module AkamaiApi
|
4
4
|
describe EccuRequest do
|
5
|
-
include
|
5
|
+
include Savon::SpecHelper
|
6
6
|
|
7
|
-
before {
|
7
|
+
before(:all) { savon.mock! }
|
8
|
+
after(:all) { savon.unmock! }
|
8
9
|
|
9
10
|
describe '::all_ids' do
|
10
|
-
before
|
11
|
+
before do
|
12
|
+
fixture = File.read 'spec/fixtures/eccu/get_ids/successful.xml'
|
13
|
+
savon.expects(:get_ids).returns(fixture)
|
14
|
+
end
|
11
15
|
|
12
16
|
it 'returns the id list of all available requests' do
|
13
17
|
EccuRequest.all_ids.should =~ ['42994282', '43000154']
|
@@ -15,26 +19,32 @@ module AkamaiApi
|
|
15
19
|
end
|
16
20
|
|
17
21
|
describe '::find' do
|
18
|
-
|
22
|
+
let(:fixture) { File.read 'spec/fixtures/eccu/get_info/successful.xml' }
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
def soap_body id, verbose
|
25
|
+
SoapBody.new do
|
26
|
+
integer :fileId, id
|
27
|
+
boolean :retrieveContents, verbose
|
24
28
|
end
|
29
|
+
end
|
25
30
|
|
26
|
-
|
27
|
-
|
31
|
+
context 'when calling the ECCU service' do
|
32
|
+
it 'sets the specified code and verbosity' do
|
33
|
+
body = soap_body(1234567, false).to_s
|
34
|
+
savon.expects(:get_info).with(:message => body).returns(fixture)
|
28
35
|
EccuRequest.find('1234567')
|
29
36
|
end
|
30
37
|
|
31
38
|
it 'sets to return file content if verbose is specified' do
|
32
|
-
|
39
|
+
body = soap_body(1234567, true).to_s
|
40
|
+
savon.expects(:get_info).with(:message => body).returns(fixture)
|
33
41
|
EccuRequest.find('1234567', :verbose => true)
|
34
42
|
end
|
35
43
|
end
|
36
44
|
|
37
45
|
it 'correctly assign the exact match' do
|
46
|
+
body = soap_body(1234567, false).to_s
|
47
|
+
savon.expects(:get_info).with(:message => body).returns(fixture)
|
38
48
|
r = EccuRequest.find('1234567')
|
39
49
|
r.property[:exact_match].should be_true
|
40
50
|
end
|
@@ -84,30 +94,37 @@ module AkamaiApi
|
|
84
94
|
|
85
95
|
describe '::publish' do
|
86
96
|
context 'when there is an error' do
|
87
|
-
before
|
97
|
+
before do
|
98
|
+
fixture = File.read 'spec/fixtures/eccu/upload/fault.xml'
|
99
|
+
savon.expects(:upload).with(:message => :any).returns(fixture)
|
100
|
+
end
|
88
101
|
|
89
102
|
it 'raises an error' do
|
90
|
-
expect { EccuRequest.publish '', xml_request_content }
|
103
|
+
expect { EccuRequest.publish '', xml_request_content }.to raise_error Savon::SOAPFault
|
91
104
|
end
|
92
105
|
end
|
93
106
|
|
94
107
|
context 'when there are no errors' do
|
95
|
-
|
108
|
+
let(:fixture) { File.read 'spec/fixtures/eccu/upload/successful.xml' }
|
96
109
|
|
97
110
|
it 'returns an EccuRequest instance' do
|
111
|
+
savon.expects(:upload).with(:message => :any).returns(fixture)
|
98
112
|
EccuRequest.publish('', xml_request_content).should be_a Fixnum
|
99
113
|
end
|
100
114
|
|
101
115
|
it 'assigns the fields correctly' do
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
116
|
+
content = xml_request_content
|
117
|
+
body = SoapBody.new do
|
118
|
+
string :filename, 'eccu_request.xml'
|
119
|
+
text :contents, content
|
120
|
+
string :notes, 'sample notes'
|
121
|
+
string :versionString, 'v2'
|
122
|
+
string :statusChangeEmail, 'foo@foo.com bar@bar.com'
|
123
|
+
string :propertyName, 'foo.com'
|
124
|
+
string :propertyType, 'prop'
|
125
|
+
boolean :propertyNameExactMatch, false
|
126
|
+
end
|
127
|
+
savon.expects(:upload).with(:message => body.to_s).returns(fixture)
|
111
128
|
EccuRequest.publish('foo.com', xml_request_content, {
|
112
129
|
:file_name => 'eccu_request.xml',
|
113
130
|
:notes => 'sample notes',
|
@@ -121,23 +138,27 @@ module AkamaiApi
|
|
121
138
|
it 'assigns a default notes field if no notes are specified' do
|
122
139
|
SoapBody.any_instance.stub :string => nil
|
123
140
|
SoapBody.any_instance.should_receive(:string).with(:notes, kind_of(String))
|
141
|
+
savon.expects(:upload).with(:message => :any).returns(fixture)
|
124
142
|
EccuRequest.publish '', xml_request_content
|
125
143
|
end
|
126
144
|
|
127
145
|
it 'assigns emails field if specified' do
|
128
146
|
SoapBody.any_instance.should_not_receive(:string).with(:statusChangeEmail, anything())
|
147
|
+
savon.expects(:upload).with(:message => :any).returns(fixture)
|
129
148
|
EccuRequest.publish '', xml_request_content
|
130
149
|
end
|
131
150
|
|
132
151
|
it 'assigns the property type to hostheader by default' do
|
133
152
|
SoapBody.any_instance.stub :string => nil
|
134
153
|
SoapBody.any_instance.should_receive(:string).with(:propertyType, 'hostheader')
|
154
|
+
savon.expects(:upload).with(:message => :any).returns(fixture)
|
135
155
|
EccuRequest.publish '', xml_request_content
|
136
156
|
end
|
137
157
|
|
138
158
|
it 'assigns the property exact match to true by default' do
|
139
159
|
SoapBody.any_instance.stub :boolean => nil
|
140
160
|
SoapBody.any_instance.should_receive(:boolean).with(:propertyNameExactMatch, true)
|
161
|
+
savon.expects(:upload).with(:message => :any).returns(fixture)
|
141
162
|
EccuRequest.publish '', xml_request_content
|
142
163
|
end
|
143
164
|
end
|
@@ -154,9 +175,10 @@ module AkamaiApi
|
|
154
175
|
end
|
155
176
|
|
156
177
|
describe '#update_notes!' do
|
157
|
-
|
178
|
+
let(:fixture) { File.read 'spec/fixtures/eccu/set_notes/successful.xml' }
|
158
179
|
|
159
180
|
it 'updates the notes field' do
|
181
|
+
savon.expects(:set_notes).with(:message => :any).returns(fixture)
|
160
182
|
req = EccuRequest.new :code => '1234'
|
161
183
|
expect {
|
162
184
|
req.update_notes! 'foo'
|
@@ -164,23 +186,25 @@ module AkamaiApi
|
|
164
186
|
end
|
165
187
|
|
166
188
|
it 'calls the ECCU service using code and notes' do
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
189
|
+
body = SoapBody.new do
|
190
|
+
integer :fileId, 1234
|
191
|
+
string :notes, 'foo'
|
192
|
+
end
|
193
|
+
savon.expects(:set_notes).with(:message => body.to_s).returns(fixture)
|
194
|
+
EccuRequest.new(:code => '1234').update_notes! 'foo'
|
172
195
|
end
|
173
196
|
|
174
197
|
it 'calls the ECCU service and return the service boolean response' do
|
175
|
-
|
176
|
-
|
198
|
+
savon.expects(:set_notes).with(:message => :any).returns(fixture)
|
199
|
+
EccuRequest.new(:code => '1234').update_notes!('foo').should be_true
|
177
200
|
end
|
178
201
|
end
|
179
202
|
|
180
203
|
describe '#update_email' do
|
181
|
-
|
204
|
+
let(:fixture) { File.read 'spec/fixtures/eccu/set_status_change_email/successful.xml' }
|
182
205
|
|
183
206
|
it 'updates the email field' do
|
207
|
+
savon.expects(:set_status_change_email).with(:message => :any).returns(fixture)
|
184
208
|
req = EccuRequest.new :code => '1234'
|
185
209
|
expect {
|
186
210
|
req.update_email! 'foo'
|
@@ -188,32 +212,46 @@ module AkamaiApi
|
|
188
212
|
end
|
189
213
|
|
190
214
|
it 'calls the ECCU service using code and email' do
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
215
|
+
body = SoapBody.new do
|
216
|
+
integer :fileId, 1234
|
217
|
+
string :statusChangeEmail, 'foo'
|
218
|
+
end
|
219
|
+
savon.expects(:set_status_change_email).with(:message => body.to_s).returns(fixture)
|
220
|
+
EccuRequest.new(:code => '1234').update_email! 'foo'
|
196
221
|
end
|
197
222
|
|
198
223
|
it 'calls the ECCU service and return the service boolean response' do
|
199
|
-
|
200
|
-
|
224
|
+
savon.expects(:set_status_change_email).with(:message => :any).returns(fixture)
|
225
|
+
EccuRequest.new(:code => '1234').update_email!('foo').should be_true
|
226
|
+
end
|
227
|
+
|
228
|
+
context 'when there is an error' do
|
229
|
+
let(:fixture) { File.read 'spec/fixtures/eccu/set_status_change_email/fault.xml' }
|
230
|
+
|
231
|
+
it 'does not update the mail' do
|
232
|
+
savon.expects(:set_status_change_email).with(:message => :any).returns(fixture)
|
233
|
+
req = EccuRequest.new :code => '1234'
|
234
|
+
expect {
|
235
|
+
req.update_email! 'foo'
|
236
|
+
}.to_not change(req, :email)
|
237
|
+
end
|
201
238
|
end
|
202
239
|
end
|
203
240
|
|
204
241
|
describe '#destroy' do
|
205
|
-
|
242
|
+
let(:fixture) { File.read 'spec/fixtures/eccu/delete/successful.xml' }
|
206
243
|
|
207
244
|
it 'calls the ECCU service using code' do
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
245
|
+
body = SoapBody.new do
|
246
|
+
integer :fileId, 1234
|
247
|
+
end
|
248
|
+
savon.expects(:delete).with(:message => body.to_s).returns(fixture)
|
249
|
+
EccuRequest.new(:code => '1234').destroy
|
212
250
|
end
|
213
251
|
|
214
252
|
it 'calls the ECCU service and return the service boolean response' do
|
215
|
-
|
216
|
-
|
253
|
+
savon.expects(:delete).with(:message => :any).returns(fixture)
|
254
|
+
EccuRequest.new(:code => '1234').destroy.should be_true
|
217
255
|
end
|
218
256
|
end
|
219
257
|
end
|
@@ -1,22 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
module AkamaiApi
|
2
4
|
describe SoapBody do
|
3
5
|
let(:config) { double :env_namespace => '', :soap_version => '2' }
|
4
|
-
subject { SoapBody.new Savon::SOAP::XML.new config}
|
5
|
-
|
6
|
-
it 'adds the soapenc ns' do
|
7
|
-
Savon::SOAP::XML.new(config).namespaces.should_not include 'xmlns:soapenc'
|
8
|
-
subject.soap.namespaces.should include 'xmlns:soapenc'
|
9
|
-
end
|
10
6
|
|
11
7
|
describe '#string' do
|
12
8
|
before { subject.string 'foo', 'sample' }
|
13
9
|
|
14
10
|
it 'adds a string field' do
|
15
|
-
subject.
|
11
|
+
subject.to_s.should =~ /<foo.*>sample<\/foo>/
|
16
12
|
end
|
17
13
|
|
18
14
|
it 'sets the correct type attribute' do
|
19
|
-
subject.
|
15
|
+
subject.to_s.should =~ /<foo xsi:type=\"xsd:string\">/
|
20
16
|
end
|
21
17
|
end
|
22
18
|
|
@@ -24,15 +20,15 @@ module AkamaiApi
|
|
24
20
|
before { subject.array 'foo', ['a', 'b'] }
|
25
21
|
|
26
22
|
it 'adds an array field' do
|
27
|
-
subject.
|
23
|
+
subject.to_s.should =~ /<foo.*><item>a<\/item><item>b<\/item><\/foo>/
|
28
24
|
end
|
29
25
|
|
30
26
|
it 'sets the correct type attribute' do
|
31
|
-
subject.
|
27
|
+
subject.to_s.should =~ /<foo.*xsi:type="wsdl:ArrayOfString"/
|
32
28
|
end
|
33
29
|
|
34
30
|
it 'sets the correct arrayType attribute' do
|
35
|
-
subject.
|
31
|
+
subject.to_s.should =~ /<foo.*soapenc:arrayType="xsd:string\[2\]"/
|
36
32
|
end
|
37
33
|
end
|
38
34
|
|
@@ -40,11 +36,12 @@ module AkamaiApi
|
|
40
36
|
before { subject.text 'foo', 'foo' }
|
41
37
|
|
42
38
|
it 'adds a base64 encoded string field' do
|
43
|
-
|
39
|
+
match = subject.to_s.match /<foo.*>(.+)<\/foo>/m
|
40
|
+
Base64.decode64(match[1]).should == 'foo'
|
44
41
|
end
|
45
42
|
|
46
43
|
it 'sets the correct type attribute' do
|
47
|
-
subject.
|
44
|
+
subject.to_s.should =~ /<foo.*xsi:type="xsd:base64Binary/
|
48
45
|
end
|
49
46
|
end
|
50
47
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
require File.expand_path '../../lib/akamai_api', __FILE__
|
2
2
|
require File.expand_path '../auth.rb', __FILE__
|
3
3
|
|
4
|
-
require '
|
4
|
+
require 'savon/mock/spec_helper'
|
5
5
|
|
6
|
-
Savon::Spec::Fixture.path = File.expand_path '../fixtures', __FILE__
|
6
|
+
# Savon::Spec::Fixture.path = File.expand_path '../fixtures', __FILE__
|
7
7
|
Dir[File.expand_path '../support/**/*.rb', __FILE__].each do |f|
|
8
8
|
require f
|
9
9
|
end
|
10
10
|
|
11
11
|
RSpec.configure do |config|
|
12
|
-
config.
|
12
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
+
config.run_all_when_everything_filtered = true
|
14
|
+
config.filter_run :focus
|
15
|
+
|
16
|
+
config.order = 'random'
|
13
17
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# This patch is needed for adding an option to not check every time the arguments of a request
|
2
|
+
module Savon
|
3
|
+
class MockExpectation
|
4
|
+
def verify_message_with_any!
|
5
|
+
verify_message_without_any! unless @expected[:message] == :any
|
6
|
+
end
|
7
|
+
|
8
|
+
alias_method_chain :verify_message!, :any
|
9
|
+
end
|
10
|
+
end
|