regenersis-savon 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.gitignore +10 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +12 -0
  4. data/CHANGELOG.md +639 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +20 -0
  7. data/README.md +42 -0
  8. data/Rakefile +7 -0
  9. data/lib/regenersis-savon.rb +1 -0
  10. data/lib/savon.rb +15 -0
  11. data/lib/savon/client.rb +168 -0
  12. data/lib/savon/core_ext/object.rb +14 -0
  13. data/lib/savon/core_ext/string.rb +23 -0
  14. data/lib/savon/error.rb +6 -0
  15. data/lib/savon/global.rb +115 -0
  16. data/lib/savon/hooks/group.rb +46 -0
  17. data/lib/savon/hooks/hook.rb +36 -0
  18. data/lib/savon/http/error.rb +42 -0
  19. data/lib/savon/model.rb +103 -0
  20. data/lib/savon/soap.rb +21 -0
  21. data/lib/savon/soap/fault.rb +59 -0
  22. data/lib/savon/soap/request.rb +71 -0
  23. data/lib/savon/soap/response.rb +109 -0
  24. data/lib/savon/soap/xml.rb +227 -0
  25. data/lib/savon/version.rb +5 -0
  26. data/lib/savon/wasabi/document.rb +41 -0
  27. data/regenersis-savon.gemspec +35 -0
  28. data/spec/fixtures/gzip/message.gz +0 -0
  29. data/spec/fixtures/response/another_soap_fault.xml +14 -0
  30. data/spec/fixtures/response/authentication.xml +14 -0
  31. data/spec/fixtures/response/header.xml +13 -0
  32. data/spec/fixtures/response/list.xml +18 -0
  33. data/spec/fixtures/response/multi_ref.xml +39 -0
  34. data/spec/fixtures/response/soap_fault.xml +8 -0
  35. data/spec/fixtures/response/soap_fault12.xml +18 -0
  36. data/spec/fixtures/response/taxcloud.xml +1 -0
  37. data/spec/fixtures/wsdl/authentication.xml +63 -0
  38. data/spec/fixtures/wsdl/lower_camel.xml +52 -0
  39. data/spec/fixtures/wsdl/multiple_namespaces.xml +61 -0
  40. data/spec/fixtures/wsdl/multiple_types.xml +60 -0
  41. data/spec/fixtures/wsdl/taxcloud.xml +934 -0
  42. data/spec/savon/client_spec.rb +461 -0
  43. data/spec/savon/core_ext/object_spec.rb +19 -0
  44. data/spec/savon/core_ext/string_spec.rb +37 -0
  45. data/spec/savon/http/error_spec.rb +52 -0
  46. data/spec/savon/model_spec.rb +194 -0
  47. data/spec/savon/savon_spec.rb +85 -0
  48. data/spec/savon/soap/fault_spec.rb +89 -0
  49. data/spec/savon/soap/request_spec.rb +57 -0
  50. data/spec/savon/soap/response_spec.rb +224 -0
  51. data/spec/savon/soap/xml_spec.rb +309 -0
  52. data/spec/savon/soap_spec.rb +16 -0
  53. data/spec/savon/wasabi/document_spec.rb +45 -0
  54. data/spec/spec_helper.rb +15 -0
  55. data/spec/support/endpoint.rb +25 -0
  56. data/spec/support/fixture.rb +35 -0
  57. metadata +323 -0
@@ -0,0 +1,57 @@
1
+ require "spec_helper"
2
+
3
+ describe Savon::SOAP::Request do
4
+ let(:soap_request) { Savon::SOAP::Request.new HTTPI::Request.new, soap }
5
+ let(:soap) { Savon::SOAP::XML.new Endpoint.soap, [nil, :get_user, {}], :id => 1 }
6
+
7
+ it "contains the content type for each supported SOAP version" do
8
+ content_type = Savon::SOAP::Request::ContentType
9
+ content_type[1].should == "text/xml;charset=UTF-8"
10
+ content_type[2].should == "application/soap+xml;charset=UTF-8"
11
+ end
12
+
13
+ describe ".execute" do
14
+ it "executes a SOAP request and returns the response" do
15
+ HTTPI.expects(:post).returns(HTTPI::Response.new 200, {}, Fixture.response(:authentication))
16
+ response = Savon::SOAP::Request.execute HTTPI::Request.new, soap
17
+ response.should be_a(Savon::SOAP::Response)
18
+ end
19
+ end
20
+
21
+ describe ".new" do
22
+ it "uses the SOAP endpoint for the request" do
23
+ soap_request.http.url.should == URI(soap.endpoint)
24
+ end
25
+
26
+ it "sets the SOAP body for the request" do
27
+ soap_request.http.body.should == soap.to_xml
28
+ end
29
+
30
+ it "sets the Content-Type header for SOAP 1.1" do
31
+ soap_request.http.headers["Content-Type"].should == Savon::SOAP::Request::ContentType[1]
32
+ end
33
+
34
+ it "sets the Content-Type header for SOAP 1.2" do
35
+ soap.version = 2
36
+ soap_request.http.headers["Content-Type"].should == Savon::SOAP::Request::ContentType[2]
37
+ end
38
+
39
+ it "does not set the Content-Type header if it's already specified" do
40
+ headers = { "Content-Type" => "text/plain" }
41
+ soap_request = Savon::SOAP::Request.new HTTPI::Request.new(:headers => headers), soap
42
+ soap_request.http.headers["Content-Type"].should == headers["Content-Type"]
43
+ end
44
+
45
+ it "sets the Content-Length header" do
46
+ soap_request.http.headers["Content-Length"].should == soap.to_xml.length.to_s
47
+ end
48
+ end
49
+
50
+ describe "#response" do
51
+ it "executes an HTTP POST request and returns a Savon::SOAP::Response" do
52
+ HTTPI.expects(:post).returns(HTTPI::Response.new 200, {}, Fixture.response(:authentication))
53
+ soap_request.response.should be_a(Savon::SOAP::Response)
54
+ end
55
+ end
56
+
57
+ end
@@ -0,0 +1,224 @@
1
+ require "spec_helper"
2
+
3
+ describe Savon::SOAP::Response do
4
+
5
+ describe ".new" do
6
+ it "should raise a Savon::SOAP::Fault in case of a SOAP fault" do
7
+ lambda { soap_fault_response }.should raise_error(Savon::SOAP::Fault)
8
+ end
9
+
10
+ it "should not raise a Savon::SOAP::Fault in case the default is turned off" do
11
+ Savon.raise_errors = false
12
+ lambda { soap_fault_response }.should_not raise_error(Savon::SOAP::Fault)
13
+ Savon.raise_errors = true
14
+ end
15
+
16
+ it "should raise a Savon::HTTP::Error in case of an HTTP error" do
17
+ lambda { soap_response :code => 500 }.should raise_error(Savon::HTTP::Error)
18
+ end
19
+
20
+ it "should not raise a Savon::HTTP::Error in case the default is turned off" do
21
+ Savon.raise_errors = false
22
+ soap_response :code => 500
23
+ Savon.raise_errors = true
24
+ end
25
+ end
26
+
27
+ describe "#success?" do
28
+ around do |example|
29
+ Savon.raise_errors = false
30
+ example.run
31
+ Savon.raise_errors = true
32
+ end
33
+
34
+ it "should return true if the request was successful" do
35
+ soap_response.should be_a_success
36
+ end
37
+
38
+ it "should return false if there was a SOAP fault" do
39
+ soap_fault_response.should_not be_a_success
40
+ end
41
+
42
+ it "should return false if there was an HTTP error" do
43
+ http_error_response.should_not be_a_success
44
+ end
45
+ end
46
+
47
+ describe "#soap_fault?" do
48
+ around do |example|
49
+ Savon.raise_errors = false
50
+ example.run
51
+ Savon.raise_errors = true
52
+ end
53
+
54
+ it "should not return true in case the response seems to be ok" do
55
+ soap_response.soap_fault?.should be_false
56
+ end
57
+
58
+ it "should return true in case of a SOAP fault" do
59
+ soap_fault_response.soap_fault?.should be_true
60
+ end
61
+ end
62
+
63
+ describe "#soap_fault" do
64
+ around do |example|
65
+ Savon.raise_errors = false
66
+ example.run
67
+ Savon.raise_errors = true
68
+ end
69
+
70
+ it "should return a Savon::SOAP::Fault" do
71
+ soap_fault_response.soap_fault.should be_a(Savon::SOAP::Fault)
72
+ end
73
+
74
+ it "should return a Savon::SOAP::Fault containing the HTTPI::Response" do
75
+ soap_fault_response.soap_fault.http.should be_an(HTTPI::Response)
76
+ end
77
+
78
+ it "should return a Savon::SOAP::Fault even if the SOAP response seems to be ok" do
79
+ soap_response.soap_fault.should be_a(Savon::SOAP::Fault)
80
+ end
81
+ end
82
+
83
+ describe "#http_error?" do
84
+ around do |example|
85
+ Savon.raise_errors = false
86
+ example.run
87
+ Savon.raise_errors = true
88
+ end
89
+
90
+ it "should not return true in case the response seems to be ok" do
91
+ soap_response.http_error?.should_not be_true
92
+ end
93
+
94
+ it "should return true in case of an HTTP error" do
95
+ soap_response(:code => 500).http_error?.should be_true
96
+ end
97
+ end
98
+
99
+ describe "#http_error" do
100
+ around do |example|
101
+ Savon.raise_errors = false
102
+ example.run
103
+ Savon.raise_errors = true
104
+ end
105
+
106
+ it "should return a Savon::HTTP::Error" do
107
+ http_error_response.http_error.should be_a(Savon::HTTP::Error)
108
+ end
109
+
110
+ it "should return a Savon::HTTP::Error containing the HTTPI::Response" do
111
+ http_error_response.http_error.http.should be_an(HTTPI::Response)
112
+ end
113
+
114
+ it "should return a Savon::HTTP::Error even if the HTTP response seems to be ok" do
115
+ soap_response.http_error.should be_a(Savon::HTTP::Error)
116
+ end
117
+ end
118
+
119
+ describe "#[]" do
120
+ it "should return the SOAP response body as a Hash" do
121
+ soap_response[:authenticate_response][:return].should ==
122
+ Fixture.response_hash(:authentication)[:authenticate_response][:return]
123
+ end
124
+ end
125
+
126
+ describe "#header" do
127
+ it "should return the SOAP response header as a Hash" do
128
+ response = soap_response :body => Fixture.response(:header)
129
+ response.header.should include(:session_number => "ABCD1234")
130
+ end
131
+ end
132
+
133
+ %w(body to_hash).each do |method|
134
+ describe "##{method}" do
135
+ it "should return the SOAP response body as a Hash" do
136
+ soap_response.send(method)[:authenticate_response][:return].should ==
137
+ Fixture.response_hash(:authentication)[:authenticate_response][:return]
138
+ end
139
+
140
+ it "should return a Hash for a SOAP multiRef response" do
141
+ hash = soap_response(:body => Fixture.response(:multi_ref)).send(method)
142
+
143
+ hash[:list_response].should be_a(Hash)
144
+ hash[:multi_ref].should be_an(Array)
145
+ end
146
+
147
+ it "should add existing namespaced elements as an array" do
148
+ hash = soap_response(:body => Fixture.response(:list)).send(method)
149
+
150
+ hash[:multi_namespaced_entry_response][:history].should be_a(Hash)
151
+ hash[:multi_namespaced_entry_response][:history][:case].should be_an(Array)
152
+ end
153
+ end
154
+ end
155
+
156
+ describe "#to_array" do
157
+ context "when the given path exists" do
158
+ it "should return an Array containing the path value" do
159
+ soap_response.to_array(:authenticate_response, :return).should ==
160
+ [Fixture.response_hash(:authentication)[:authenticate_response][:return]]
161
+ end
162
+ end
163
+
164
+ context "when the given path returns nil" do
165
+ it "should return an empty Array" do
166
+ soap_response.to_array(:authenticate_response, :undefined).should == []
167
+ end
168
+ end
169
+
170
+ context "when the given path does not exist at all" do
171
+ it "should return an empty Array" do
172
+ soap_response.to_array(:authenticate_response, :some, :undefined, :path).should == []
173
+ end
174
+ end
175
+ end
176
+
177
+ describe "#hash" do
178
+ it "should return the complete SOAP response XML as a Hash" do
179
+ response = soap_response :body => Fixture.response(:header)
180
+ response.hash[:envelope][:header][:session_number].should == "ABCD1234"
181
+ end
182
+ end
183
+
184
+ describe "#to_xml" do
185
+ it "should return the raw SOAP response body" do
186
+ soap_response.to_xml.should == Fixture.response(:authentication)
187
+ end
188
+ end
189
+
190
+ describe "#doc" do
191
+ it "returns a Nokogiri::XML::Document for the SOAP response XML" do
192
+ soap_response.doc.should be_a(Nokogiri::XML::Document)
193
+ end
194
+ end
195
+
196
+ describe "#xpath" do
197
+ it "permits XPath access to elements in the request" do
198
+ soap_response.xpath("//client").first.inner_text.should == "radclient"
199
+ soap_response.xpath("//ns2:authenticateResponse/return/success").first.inner_text.should == "true"
200
+ end
201
+ end
202
+
203
+ describe "#http" do
204
+ it "should return the HTTPI::Response" do
205
+ soap_response.http.should be_an(HTTPI::Response)
206
+ end
207
+ end
208
+
209
+ def soap_response(options = {})
210
+ defaults = { :code => 200, :headers => {}, :body => Fixture.response(:authentication) }
211
+ response = defaults.merge options
212
+
213
+ Savon::SOAP::Response.new HTTPI::Response.new(response[:code], response[:headers], response[:body])
214
+ end
215
+
216
+ def soap_fault_response
217
+ soap_response :code => 500, :body => Fixture.response(:soap_fault)
218
+ end
219
+
220
+ def http_error_response
221
+ soap_response :code => 404, :body => "Not found"
222
+ end
223
+
224
+ end
@@ -0,0 +1,309 @@
1
+ require "spec_helper"
2
+
3
+ describe Savon::SOAP::XML do
4
+ let(:xml) { Savon::SOAP::XML.new Endpoint.soap, [nil, :authenticate, {}], :id => 1 }
5
+
6
+ describe ".new" do
7
+ it "should accept an endpoint, an input tag and a SOAP body" do
8
+ xml = Savon::SOAP::XML.new Endpoint.soap, [nil, :authentication, {}], :id => 1
9
+
10
+ xml.endpoint.should == Endpoint.soap
11
+ xml.input.should == [nil, :authentication, {}]
12
+ xml.body.should == { :id => 1 }
13
+ end
14
+ end
15
+
16
+ describe "#input" do
17
+ it "should set the input tag" do
18
+ xml.input = :test
19
+ xml.input.should == :test
20
+ end
21
+ end
22
+
23
+ describe "#endpoint" do
24
+ it "should set the endpoint to use" do
25
+ xml.endpoint = "http://test.com"
26
+ xml.endpoint.should == "http://test.com"
27
+ end
28
+ end
29
+
30
+ describe "#version" do
31
+ it "should default to SOAP 1.1" do
32
+ xml.version.should == 1
33
+ end
34
+
35
+ it "should default to the global default" do
36
+ Savon.soap_version = 2
37
+ xml.version.should == 2
38
+
39
+ reset_soap_version
40
+ end
41
+
42
+ it "should set the SOAP version to use" do
43
+ xml.version = 2
44
+ xml.version.should == 2
45
+ end
46
+
47
+ it "should raise an ArgumentError in case of an invalid version" do
48
+ lambda { xml.version = 3 }.should raise_error(ArgumentError)
49
+ end
50
+ end
51
+
52
+ describe "#header" do
53
+ it "should default to an empty Hash" do
54
+ xml.header.should == {}
55
+ end
56
+
57
+ it "should set the SOAP header" do
58
+ xml.header = { "MySecret" => "abc" }
59
+ xml.header.should == { "MySecret" => "abc" }
60
+ end
61
+
62
+ it "should use the global soap_header if set" do
63
+ Savon.stubs(:soap_header).returns({ "MySecret" => "abc" })
64
+ xml.header.should == { "MySecret" => "abc" }
65
+ end
66
+ end
67
+
68
+ describe "#env_namespace" do
69
+ it "should default to :env" do
70
+ xml.env_namespace.should == :env
71
+ end
72
+
73
+ it "should set the SOAP envelope namespace" do
74
+ xml.env_namespace = :soapenv
75
+ xml.env_namespace.should == :soapenv
76
+ end
77
+
78
+ it "should use the global env_namespace if set as the SOAP envelope namespace" do
79
+ Savon.stubs(:env_namespace).returns(:soapenv)
80
+ xml.env_namespace.should == :soapenv
81
+ end
82
+ end
83
+
84
+ describe "#namespaces" do
85
+ it "should default to a Hash containing the namespace for SOAP 1.1" do
86
+ xml.namespaces.should == { "xmlns:env" => "http://schemas.xmlsoap.org/soap/envelope/" }
87
+ end
88
+
89
+ it "should default to a Hash containing the namespace for SOAP 1.2 if that's the current version" do
90
+ xml.version = 2
91
+ xml.namespaces.should == { "xmlns:env" => "http://www.w3.org/2003/05/soap-envelope" }
92
+ end
93
+
94
+ it "should set the SOAP header" do
95
+ xml.namespaces = { "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" }
96
+ xml.namespaces.should == { "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" }
97
+ end
98
+ end
99
+
100
+ describe "#wsse" do
101
+ it "should set the Akami::WSSE object" do
102
+ xml.wsse = Akami.wsse
103
+ xml.wsse.should be_a(Akami::WSSE)
104
+ end
105
+ end
106
+
107
+ describe "#body" do
108
+ it "should set the SOAP body Hash" do
109
+ xml.body = { :id => 1 }
110
+ xml.to_xml.should include("<id>1</id>")
111
+ end
112
+
113
+ it "should accepts an XML String" do
114
+ xml.body = "<id>1</id>"
115
+ xml.to_xml.should include("<id>1</id>")
116
+ end
117
+
118
+ it "should accept a block" do
119
+ xml.body do |body|
120
+ body.user { body.id 1 }
121
+ end
122
+
123
+ xml.to_xml.should include("<authenticate><user><id>1</id></user></authenticate>")
124
+ end
125
+ end
126
+
127
+ describe "#xml" do
128
+ it "lets you specify a completely custom XML String" do
129
+ xml.xml = "<custom>xml</custom>"
130
+ xml.to_xml.should == "<custom>xml</custom>"
131
+ end
132
+
133
+ it "yields a Builder::XmlMarkup object to a given block" do
134
+ xml.xml { |xml| xml.using("Builder") }
135
+ xml.to_xml.should == '<?xml version="1.0" encoding="UTF-8"?><using>Builder</using>'
136
+ end
137
+
138
+ it "accepts options to pass to the Builder::XmlMarkup instruct!" do
139
+ xml.xml :xml, :aaa => :bbb do |xml|
140
+ xml.using("Builder")
141
+ end
142
+
143
+ xml.to_xml.should == '<?xml version="1.0" encoding="UTF-8" aaa="bbb"?><using>Builder</using>'
144
+ end
145
+
146
+ it "can change encoding to UTF-16" do
147
+ xml.xml(:xml, :encoding => "UTF-16") { |xml| xml.using("Builder") }
148
+ xml.to_xml.should == '<?xml version="1.0" encoding="UTF-16"?><using>Builder</using>'
149
+ end
150
+ end
151
+
152
+ describe "#to_xml" do
153
+ after { reset_soap_version }
154
+
155
+ context "by default" do
156
+ it "should start with an XML declaration" do
157
+ xml.to_xml.should match(/^<\?xml version="1.0" encoding="UTF-8"\?>/)
158
+ end
159
+
160
+ it "should use default SOAP envelope namespace" do
161
+ xml.to_xml.should include("<env:Envelope", "<env:Body")
162
+ end
163
+
164
+ it "should add the xsd namespace" do
165
+ uri = "http://www.w3.org/2001/XMLSchema"
166
+ xml.to_xml.should match(/<env:Envelope (.*)xmlns:xsd="#{uri}"(.*)>/)
167
+ end
168
+
169
+ it "should add the xsi namespace" do
170
+ uri = "http://www.w3.org/2001/XMLSchema-instance"
171
+ xml.to_xml.should match(/<env:Envelope (.*)xmlns:xsi="#{uri}"(.*)>/)
172
+ end
173
+
174
+ it "should have a SOAP envelope tag with a SOAP 1.1 namespace" do
175
+ uri = "http://schemas.xmlsoap.org/soap/envelope/"
176
+ xml.to_xml.should match(/<env:Envelope (.*)xmlns:env="#{uri}"(.*)>/)
177
+ end
178
+
179
+ it "should have a SOAP body containing the SOAP input tag and body Hash" do
180
+ xml.to_xml.should include('<env:Body><authenticate><id>1</id></authenticate></env:Body>')
181
+ end
182
+
183
+ it "should accept a SOAP body as an XML String" do
184
+ xml.body = "<someId>1</someId>"
185
+ xml.to_xml.should include('<env:Body><authenticate><someId>1</someId></authenticate></env:Body>')
186
+ end
187
+
188
+ it "should not contain a SOAP header" do
189
+ xml.to_xml.should_not include('<env:Header')
190
+ end
191
+ end
192
+
193
+ context "with a SOAP header" do
194
+ it "should contain the given header" do
195
+ xml.header = {
196
+ :token => "secret",
197
+ :attributes! => { :token => { :xmlns => "http://example.com" } }
198
+ }
199
+
200
+ xml.to_xml.should include('<env:Header><token xmlns="http://example.com">secret</token></env:Header>')
201
+ end
202
+ end
203
+
204
+ context "with the global SOAP version set to 1.2" do
205
+ it "should contain the namespace for SOAP 1.2" do
206
+ Savon.soap_version = 2
207
+
208
+ uri = "http://www.w3.org/2003/05/soap-envelope"
209
+ xml.to_xml.should match(/<env:Envelope (.*)xmlns:env="#{uri}"(.*)>/)
210
+ reset_soap_version
211
+ end
212
+ end
213
+
214
+ context "with a global and request SOAP version" do
215
+ it "should contain the namespace for the request SOAP version" do
216
+ Savon.soap_version = 2
217
+ xml.version = 1
218
+
219
+ uri = "http://schemas.xmlsoap.org/soap/envelope/"
220
+ xml.to_xml.should match(/<env:Envelope (.*)xmlns:env="#{uri}"(.*)>/)
221
+ reset_soap_version
222
+ end
223
+ end
224
+
225
+ context "with the SOAP envelope namespace set to an empty String" do
226
+ it "should not add a namespace to SOAP envelope tags" do
227
+ xml.env_namespace = ""
228
+ xml.to_xml.should include("<Envelope", "<Body")
229
+ end
230
+ end
231
+
232
+ context "using the #namespace and #namespace_identifier" do
233
+ it "should contain the specified namespace" do
234
+ xml.namespace_identifier = :wsdl
235
+ xml.namespace = "http://example.com"
236
+ xml.to_xml.should include('xmlns:wsdl="http://example.com"')
237
+ end
238
+ end
239
+
240
+ context "with :element_form_default set to :qualified and a :namespace" do
241
+ let :xml do
242
+ Savon::SOAP::XML.new Endpoint.soap, [nil, :authenticate, {}], :user => { :id => 1, ":noNamespace" => true }
243
+ end
244
+
245
+ it "should namespace the default elements" do
246
+ xml.element_form_default = :qualified
247
+ xml.namespace_identifier = :wsdl
248
+
249
+ xml.to_xml.should include(
250
+ "<wsdl:user>",
251
+ "<wsdl:id>1</wsdl:id>",
252
+ "<noNamespace>true</noNamespace>"
253
+ )
254
+ end
255
+ end
256
+
257
+ context "with WSSE authentication" do
258
+ it "should containg a SOAP header with WSSE authentication details" do
259
+ xml.wsse = Akami.wsse
260
+ xml.wsse.credentials "username", "password"
261
+
262
+ xml.to_xml.should include("<env:Header><wsse:Security")
263
+ xml.to_xml.should include("<wsse:Username>username</wsse:Username>")
264
+ xml.to_xml.should include("password</wsse:Password>")
265
+ end
266
+ end
267
+
268
+ context "with a simple input tag (Symbol)" do
269
+ it "should just add the input tag" do
270
+ xml.input = [nil, :simple, {}]
271
+ xml.to_xml.should include('<simple><id>1</id></simple>')
272
+ end
273
+ end
274
+
275
+ context "with a simple input tag (Array)" do
276
+ it "should just add the input tag" do
277
+ xml.input = [nil, :simple, {}]
278
+ xml.to_xml.should include('<simple><id>1</id></simple>')
279
+ end
280
+ end
281
+
282
+ context "with an input tag and a namespace Hash (Array)" do
283
+ it "should contain the input tag with namespaces" do
284
+ xml.input = [nil, :getUser, { "active" => true }]
285
+ xml.to_xml.should include('<getUser active="true"><id>1</id></getUser>')
286
+ end
287
+ end
288
+
289
+ context "with a prefixed input tag (Array)" do
290
+ it "should contain a prefixed input tag" do
291
+ xml.input = [:wsdl, :getUser, {}]
292
+ xml.to_xml.should include('<wsdl:getUser><id>1</id></wsdl:getUser>')
293
+ end
294
+ end
295
+
296
+ context "with a prefixed input tag and a namespace Hash (Array)" do
297
+ it "should contain a prefixed input tag with namespaces" do
298
+ xml.input = [:wsdl, :getUser, { :only_active => false }]
299
+ xml.to_xml.should include('<wsdl:getUser only_active="false"><id>1</id></wsdl:getUser>')
300
+ end
301
+ end
302
+ end
303
+
304
+ def reset_soap_version
305
+ Savon.soap_version = Savon::SOAP::DefaultVersion
306
+ end
307
+
308
+ end
309
+