savon 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/CHANGELOG.md +119 -104
  2. data/README.md +12 -11
  3. data/Rakefile +0 -6
  4. data/lib/savon.rb +16 -14
  5. data/lib/savon/block_interface.rb +26 -0
  6. data/lib/savon/builder.rb +142 -0
  7. data/lib/savon/client.rb +36 -135
  8. data/lib/savon/header.rb +42 -0
  9. data/lib/savon/http_error.rb +27 -0
  10. data/lib/savon/log_message.rb +23 -25
  11. data/lib/savon/message.rb +35 -0
  12. data/lib/savon/mock.rb +5 -0
  13. data/lib/savon/mock/expectation.rb +70 -0
  14. data/lib/savon/mock/spec_helper.rb +62 -0
  15. data/lib/savon/model.rb +39 -61
  16. data/lib/savon/operation.rb +62 -0
  17. data/lib/savon/options.rb +265 -0
  18. data/lib/savon/qualified_message.rb +49 -0
  19. data/lib/savon/request.rb +92 -0
  20. data/lib/savon/response.rb +97 -0
  21. data/lib/savon/soap_fault.rb +40 -0
  22. data/lib/savon/version.rb +1 -1
  23. data/savon.gemspec +10 -8
  24. data/spec/integration/options_spec.rb +536 -0
  25. data/spec/integration/request_spec.rb +31 -16
  26. data/spec/integration/support/application.rb +80 -0
  27. data/spec/integration/support/server.rb +84 -0
  28. data/spec/savon/builder_spec.rb +81 -0
  29. data/spec/savon/client_spec.rb +90 -488
  30. data/spec/savon/http_error_spec.rb +49 -0
  31. data/spec/savon/log_message_spec.rb +33 -0
  32. data/spec/savon/mock_spec.rb +127 -0
  33. data/spec/savon/model_spec.rb +110 -99
  34. data/spec/savon/observers_spec.rb +92 -0
  35. data/spec/savon/operation_spec.rb +49 -0
  36. data/spec/savon/request_spec.rb +145 -0
  37. data/spec/savon/{soap/response_spec.rb → response_spec.rb} +22 -59
  38. data/spec/savon/soap_fault_spec.rb +94 -0
  39. data/spec/spec_helper.rb +5 -3
  40. data/spec/support/fixture.rb +5 -1
  41. metadata +202 -197
  42. data/lib/savon/config.rb +0 -46
  43. data/lib/savon/error.rb +0 -6
  44. data/lib/savon/hooks/group.rb +0 -68
  45. data/lib/savon/hooks/hook.rb +0 -61
  46. data/lib/savon/http/error.rb +0 -42
  47. data/lib/savon/logger.rb +0 -39
  48. data/lib/savon/null_logger.rb +0 -10
  49. data/lib/savon/soap.rb +0 -21
  50. data/lib/savon/soap/fault.rb +0 -59
  51. data/lib/savon/soap/invalid_response_error.rb +0 -13
  52. data/lib/savon/soap/request.rb +0 -86
  53. data/lib/savon/soap/request_builder.rb +0 -205
  54. data/lib/savon/soap/response.rb +0 -117
  55. data/lib/savon/soap/xml.rb +0 -257
  56. data/spec/savon/config_spec.rb +0 -38
  57. data/spec/savon/hooks/group_spec.rb +0 -71
  58. data/spec/savon/hooks/hook_spec.rb +0 -16
  59. data/spec/savon/http/error_spec.rb +0 -52
  60. data/spec/savon/logger_spec.rb +0 -51
  61. data/spec/savon/savon_spec.rb +0 -33
  62. data/spec/savon/soap/fault_spec.rb +0 -89
  63. data/spec/savon/soap/request_builder_spec.rb +0 -207
  64. data/spec/savon/soap/request_spec.rb +0 -112
  65. data/spec/savon/soap/xml_spec.rb +0 -357
  66. data/spec/savon/soap_spec.rb +0 -16
@@ -0,0 +1,92 @@
1
+ require "spec_helper"
2
+ require "integration/support/server"
3
+
4
+ describe Savon do
5
+
6
+ before :all do
7
+ @server = IntegrationServer.run
8
+ end
9
+
10
+ after :all do
11
+ @server.stop
12
+ end
13
+
14
+ describe ".observers" do
15
+ after :each do
16
+ Savon.observers.clear
17
+ end
18
+
19
+ it "allows to register an observer for every request" do
20
+ observer = Class.new {
21
+
22
+ def notify(operation_name, builder, globals, locals)
23
+ @operation_name = operation_name
24
+
25
+ @builder = builder
26
+ @globals = globals
27
+ @locals = locals
28
+
29
+ # return nil to execute the request
30
+ nil
31
+ end
32
+
33
+ attr_reader :operation_name, :builder, :globals, :locals
34
+
35
+ }.new
36
+
37
+ Savon.observers << observer
38
+
39
+ new_client.call(:authenticate)
40
+
41
+ expect(observer.operation_name).to eq(:authenticate)
42
+
43
+ expect(observer.builder).to be_a(Savon::Builder)
44
+ expect(observer.globals).to be_a(Savon::GlobalOptions)
45
+ expect(observer.locals).to be_a(Savon::LocalOptions)
46
+ end
47
+
48
+ it "allows to register an observer which mocks requests" do
49
+ observer = Class.new {
50
+
51
+ def notify(*)
52
+ # return a response to mock the request
53
+ HTTPI::Response.new(201, { "X-Result" => "valid" }, "valid!")
54
+ end
55
+
56
+ }.new
57
+
58
+ Savon.observers << observer
59
+
60
+ response = new_client.call(:authenticate)
61
+
62
+ expect(response.http.code).to eq(201)
63
+ expect(response.http.headers).to eq("X-Result" => "valid")
64
+ expect(response.http.body).to eq("valid!")
65
+ end
66
+
67
+ it "raises if an observer returns something other than nil or an HTTPI::Response" do
68
+ observer = Class.new {
69
+
70
+ def notify(*)
71
+ []
72
+ end
73
+
74
+ }.new
75
+
76
+ Savon.observers << observer
77
+
78
+ expect { new_client.call(:authenticate) }.
79
+ to raise_error(Savon::Error, "Observers need to return an HTTPI::Response " \
80
+ "to mock the request or nil to execute the request.")
81
+ end
82
+ end
83
+
84
+ def new_client
85
+ Savon.client(
86
+ :endpoint => @server.url(:repeat),
87
+ :namespace => "http://v1.example.com",
88
+ :log => false
89
+ )
90
+ end
91
+
92
+ end
@@ -0,0 +1,49 @@
1
+ require "spec_helper"
2
+ require "integration/support/server"
3
+
4
+ describe Savon::Operation do
5
+
6
+ let(:globals) { Savon::GlobalOptions.new(:endpoint => @server.url(:repeat), :log => false) }
7
+ let(:wsdl) { Wasabi::Document.new Fixture.wsdl(:authentication) }
8
+ let(:no_wsdl) { Wasabi::Document.new }
9
+
10
+ before :all do
11
+ @server = IntegrationServer.run
12
+ end
13
+
14
+ after :all do
15
+ @server.stop
16
+ end
17
+
18
+ describe ".create with a WSDL" do
19
+ it "returns a new operation" do
20
+ operation = Savon::Operation.create(:authenticate, wsdl, globals)
21
+ expect(operation).to be_a(Savon::Operation)
22
+ end
23
+
24
+ it "raises if the operation name is not a Symbol" do
25
+ expect { Savon::Operation.create("not a symbol", wsdl, globals) }.
26
+ to raise_error(ArgumentError, /Expected the first parameter \(the name of the operation to call\) to be a symbol/)
27
+ end
28
+
29
+ it "raises if the operation is not available for the service" do
30
+ expect { Savon::Operation.create(:no_such_operation, wsdl, globals) }.
31
+ to raise_error(ArgumentError, /Unable to find SOAP operation: :no_such_operation/)
32
+ end
33
+ end
34
+
35
+ describe ".create without a WSDL" do
36
+ it "returns a new operation" do
37
+ operation = Savon::Operation.create(:authenticate, no_wsdl, globals)
38
+ expect(operation).to be_a(Savon::Operation)
39
+ end
40
+ end
41
+
42
+ describe "#call" do
43
+ it "returns a response object" do
44
+ operation = Savon::Operation.create(:authenticate, wsdl, globals)
45
+ expect(operation.call).to be_a(Savon::Response)
46
+ end
47
+ end
48
+
49
+ end
@@ -0,0 +1,145 @@
1
+ require "spec_helper"
2
+ require "integration/support/server"
3
+
4
+ describe Savon::Request do
5
+
6
+ subject(:request) { Savon::Request.new(:authenticate, wsdl, globals, locals) }
7
+
8
+ let(:globals) { Savon::GlobalOptions.new(:endpoint => @server.url, :log => false) }
9
+ let(:locals) { Savon::LocalOptions.new }
10
+ let(:wsdl) { Wasabi::Document.new Fixture.wsdl(:authentication) }
11
+ let(:no_wsdl) { Wasabi::Document.new }
12
+
13
+ before :all do
14
+ @server = IntegrationServer.run
15
+ end
16
+
17
+ after :all do
18
+ @server.stop
19
+ end
20
+
21
+ describe "#call" do
22
+ it "expects the XML to POST" do
23
+ response = request.call("<xml/>")
24
+
25
+ expect(request.http.url).to eq(URI(globals[:endpoint]))
26
+ expect(request.http.body).to eq("<xml/>")
27
+ expect(request.http.headers["Content-Length"]).to eq("<xml/>".bytesize.to_s)
28
+
29
+ expect(response).to be_a(HTTPI::Response)
30
+ end
31
+
32
+ it "falls back to use the WSDL's endpoint if the global :endpoint option was not set" do
33
+ wsdl.endpoint = @server.url
34
+ globals_without_endpoint = Savon::GlobalOptions.new(:log => false)
35
+ request = Savon::Request.new(:authenticate, wsdl, globals_without_endpoint, locals)
36
+ response = request.call("<xml/>")
37
+
38
+ expect(request.http.url).to eq(URI(wsdl.endpoint))
39
+ end
40
+
41
+ it "sets the global :proxy option if it's available" do
42
+ globals[:proxy] = "http://proxy.example.com"
43
+ expect(request.http.proxy).to eq(URI(globals[:proxy]))
44
+ end
45
+
46
+ it "does not set the global :proxy option when it's not available" do
47
+ expect(request.http.proxy).to be_nil
48
+ end
49
+
50
+ it "sets the request cookies using the global :last_response option if it's available" do
51
+ http = HTTPI::Response.new(200, {}, ["<success/>"])
52
+ globals[:last_response] = Savon::Response.new(http, globals, locals)
53
+
54
+ HTTPI::Request.any_instance.expects(:set_cookies).with(globals[:last_response]).once
55
+ request
56
+ end
57
+
58
+ it "does not set the cookies using the global :last_response option when it's not available" do
59
+ expect(request.http.open_timeout).to be_nil
60
+ end
61
+
62
+ it "sets the global :open_timeout option if it's available" do
63
+ globals[:open_timeout] = 33
64
+ expect(request.http.open_timeout).to eq(globals[:open_timeout])
65
+ end
66
+
67
+ it "does not set the global :open_timeout option when it's not available" do
68
+ request.call("<xml/>")
69
+ expect(request.http.open_timeout).to be_nil
70
+ end
71
+
72
+ it "sets the global :read_timeout option if it's available" do
73
+ globals[:read_timeout] = 44
74
+ expect(request.http.read_timeout).to eq(globals[:read_timeout])
75
+ end
76
+
77
+ it "does not set the global :read_timeout option when it's not available" do
78
+ expect(request.http.read_timeout).to be_nil
79
+ end
80
+
81
+ it "sets the global :headers option if it's available" do
82
+ globals[:headers] = { "X-Authorize" => "secret" }
83
+ expect(request.http.headers["X-Authorize"]).to eq("secret")
84
+ end
85
+
86
+ it "sets the SOAPAction header using the local :soap_action option if it's available" do
87
+ locals[:soap_action] = "urn://authenticate"
88
+ expect(request.http.headers["SOAPAction"]).to eq(%{"#{locals[:soap_action]}"})
89
+ end
90
+
91
+ it "sets the SOAPAction header using the WSDL if it's available" do
92
+ expect(request.http.headers["SOAPAction"]).to eq(%{"authenticate"})
93
+ end
94
+
95
+ it "sets the SOAPAction header using Gyoku if both option and WSDL were not set" do
96
+ request = Savon::Request.new(:authenticate, no_wsdl, globals, locals)
97
+ expect(request.http.headers["SOAPAction"]).to eq(%{"authenticate"})
98
+ end
99
+
100
+ it "does not set the SOAPAction header if it's already set" do
101
+ locals[:soap_action] = "urn://authenticate"
102
+ globals[:headers] = { "SOAPAction" => %{"doAuthenticate"} }
103
+
104
+ expect(request.http.headers["SOAPAction"]).to eq(%{"doAuthenticate"})
105
+ end
106
+
107
+ it "does not set the SOAPAction header if the local :soap_action was set to nil" do
108
+ locals[:soap_action] = nil
109
+ expect(request.http.headers).to_not include("SOAPAction")
110
+ end
111
+
112
+ it "sets the SOAP 1.2 Content-Type header using the global :soap_version and :encoding options if available" do
113
+ globals[:soap_version] = 2
114
+ globals[:encoding] = "UTF-16"
115
+
116
+ expect(request.http.headers["Content-Type"]).to eq("application/soap+xml;charset=UTF-16")
117
+ end
118
+
119
+ it "sets the SOAP 1.1 Content-Type header using the global :soap_version and :encoding options if available" do
120
+ globals[:soap_version] = 1
121
+ globals[:encoding] = "UTF-8"
122
+
123
+ expect(request.http.headers["Content-Type"]).to eq("text/xml;charset=UTF-8")
124
+ end
125
+
126
+ it "sets the global :basic_auth option if it's available" do
127
+ globals[:basic_auth] = [:luke, "secret"]
128
+ expect(request.http.auth.basic).to eq(globals[:basic_auth])
129
+ end
130
+
131
+ it "does not set the global :basic_auth option when it's not available" do
132
+ expect(request.http.auth.basic).to be_nil
133
+ end
134
+
135
+ it "sets the global :digest_auth option if it's available" do
136
+ globals[:digest_auth] = [:lea, "top-secret"]
137
+ expect(request.http.auth.digest).to eq(globals[:digest_auth])
138
+ end
139
+
140
+ it "does not set the global :digest_auth option when it's not available" do
141
+ expect(request.http.auth.digest).to be_nil
142
+ end
143
+ end
144
+
145
+ end
@@ -1,31 +1,32 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Savon::SOAP::Response do
3
+ describe Savon::Response do
4
4
 
5
- let(:config) { Savon::Config.default }
5
+ let(:globals) { Savon::GlobalOptions.new }
6
+ let(:locals) { Savon::LocalOptions.new }
6
7
 
7
8
  describe ".new" do
8
- it "should raise a Savon::SOAP::Fault in case of a SOAP fault" do
9
- lambda { soap_fault_response }.should raise_error(Savon::SOAP::Fault)
9
+ it "should raise a Savon::Fault in case of a SOAP fault" do
10
+ lambda { soap_fault_response }.should raise_error(Savon::SOAPFault)
10
11
  end
11
12
 
12
- it "should not raise a Savon::SOAP::Fault in case the default is turned off" do
13
- config.raise_errors = false
14
- lambda { soap_fault_response }.should_not raise_error(Savon::SOAP::Fault)
13
+ it "should not raise a Savon::Fault in case the default is turned off" do
14
+ globals[:raise_errors] = false
15
+ lambda { soap_fault_response }.should_not raise_error(Savon::SOAPFault)
15
16
  end
16
17
 
17
18
  it "should raise a Savon::HTTP::Error in case of an HTTP error" do
18
- lambda { soap_response :code => 500 }.should raise_error(Savon::HTTP::Error)
19
+ lambda { soap_response :code => 500 }.should raise_error(Savon::HTTPError)
19
20
  end
20
21
 
21
22
  it "should not raise a Savon::HTTP::Error in case the default is turned off" do
22
- config.raise_errors = false
23
+ globals[:raise_errors] = false
23
24
  soap_response :code => 500
24
25
  end
25
26
  end
26
27
 
27
28
  describe "#success?" do
28
- before { config.raise_errors = false }
29
+ before { globals[:raise_errors] = false }
29
30
 
30
31
  it "should return true if the request was successful" do
31
32
  soap_response.should be_a_success
@@ -41,7 +42,7 @@ describe Savon::SOAP::Response do
41
42
  end
42
43
 
43
44
  describe "#soap_fault?" do
44
- before { config.raise_errors = false }
45
+ before { globals[:raise_errors] = false }
45
46
 
46
47
  it "should not return true in case the response seems to be ok" do
47
48
  soap_response.soap_fault?.should be_false
@@ -52,24 +53,8 @@ describe Savon::SOAP::Response do
52
53
  end
53
54
  end
54
55
 
55
- describe "#soap_fault" do
56
- before { config.raise_errors = false }
57
-
58
- it "should return a Savon::SOAP::Fault" do
59
- soap_fault_response.soap_fault.should be_a(Savon::SOAP::Fault)
60
- end
61
-
62
- it "should return a Savon::SOAP::Fault containing the HTTPI::Response" do
63
- soap_fault_response.soap_fault.http.should be_an(HTTPI::Response)
64
- end
65
-
66
- it "should return a Savon::SOAP::Fault even if the SOAP response seems to be ok" do
67
- soap_response.soap_fault.should be_a(Savon::SOAP::Fault)
68
- end
69
- end
70
-
71
56
  describe "#http_error?" do
72
- before { config.raise_errors = false }
57
+ before { globals[:raise_errors] = false }
73
58
 
74
59
  it "should not return true in case the response seems to be ok" do
75
60
  soap_response.http_error?.should_not be_true
@@ -80,33 +65,6 @@ describe Savon::SOAP::Response do
80
65
  end
81
66
  end
82
67
 
83
- describe "#http_error" do
84
- before { config.raise_errors = false }
85
-
86
- it "should return a Savon::HTTP::Error" do
87
- http_error_response.http_error.should be_a(Savon::HTTP::Error)
88
- end
89
-
90
- it "should return a Savon::HTTP::Error containing the HTTPI::Response" do
91
- http_error_response.http_error.http.should be_an(HTTPI::Response)
92
- end
93
-
94
- it "should return a Savon::HTTP::Error even if the HTTP response seems to be ok" do
95
- soap_response.http_error.should be_a(Savon::HTTP::Error)
96
- end
97
- end
98
-
99
- describe "#[]" do
100
- it "should return the SOAP response body as a Hash" do
101
- soap_response[:authenticate_response][:return].should ==
102
- Fixture.response_hash(:authentication)[:authenticate_response][:return]
103
- end
104
-
105
- it "should throw an exception when the response body isn't parsable" do
106
- lambda { invalid_soap_response.body }.should raise_error Savon::SOAP::InvalidResponseError
107
- end
108
- end
109
-
110
68
  describe "#header" do
111
69
  it "should return the SOAP response header as a Hash" do
112
70
  response = soap_response :body => Fixture.response(:header)
@@ -114,7 +72,7 @@ describe Savon::SOAP::Response do
114
72
  end
115
73
 
116
74
  it "should throw an exception when the response header isn't parsable" do
117
- lambda { invalid_soap_response.header }.should raise_error Savon::SOAP::InvalidResponseError
75
+ lambda { invalid_soap_response.header }.should raise_error Savon::InvalidResponseError
118
76
  end
119
77
  end
120
78
 
@@ -147,6 +105,11 @@ describe Savon::SOAP::Response do
147
105
  soap_response.to_array(:authenticate_response, :return).should ==
148
106
  [Fixture.response_hash(:authentication)[:authenticate_response][:return]]
149
107
  end
108
+
109
+ it "should properly return FalseClass values [#327]" do
110
+ body = Gyoku.xml(:envelope => { :body => { :return => { :success => false } } })
111
+ soap_response(:body => body).to_array(:return, :success).should == [false]
112
+ end
150
113
  end
151
114
 
152
115
  context "when the given path returns nil" do
@@ -199,7 +162,7 @@ describe Savon::SOAP::Response do
199
162
  response = defaults.merge options
200
163
  http_response = HTTPI::Response.new(response[:code], response[:headers], response[:body])
201
164
 
202
- Savon::SOAP::Response.new(config, http_response)
165
+ Savon::Response.new(http_response, globals, locals)
203
166
  end
204
167
 
205
168
  def soap_fault_response
@@ -210,12 +173,12 @@ describe Savon::SOAP::Response do
210
173
  soap_response :code => 404, :body => "Not found"
211
174
  end
212
175
 
213
- def invalid_soap_response(options={})
176
+ def invalid_soap_response(options = {})
214
177
  defaults = { :code => 200, :headers => {}, :body => "I'm not SOAP" }
215
178
  response = defaults.merge options
216
179
  http_response = HTTPI::Response.new(response[:code], response[:headers], response[:body])
217
180
 
218
- Savon::SOAP::Response.new(config, http_response)
181
+ Savon::Response.new(http_response, globals, locals)
219
182
  end
220
183
 
221
184
  end
@@ -0,0 +1,94 @@
1
+ require "spec_helper"
2
+
3
+ describe Savon::SOAPFault do
4
+ let(:soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault)), nori }
5
+ let(:soap_fault2) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault12)), nori }
6
+ let(:another_soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:another_soap_fault)), nori }
7
+ let(:no_fault) { Savon::SOAPFault.new new_response, nori }
8
+
9
+ let(:nori) { Nori.new(:strip_namespaces => true, :convert_tags_to => lambda { |tag| tag.snakecase.to_sym }) }
10
+
11
+ it "inherits from Savon::Error" do
12
+ expect(Savon::SOAPFault.ancestors).to include(Savon::Error)
13
+ end
14
+
15
+ describe "#http" do
16
+ it "returns the HTTPI::Response" do
17
+ expect(soap_fault.http).to be_an(HTTPI::Response)
18
+ end
19
+ end
20
+
21
+ describe ".present?" do
22
+ it "returns true if the HTTP response contains a SOAP 1.1 fault" do
23
+ http = new_response(:body => Fixture.response(:soap_fault))
24
+ expect(Savon::SOAPFault.present? http).to be_true
25
+ end
26
+
27
+ it "returns true if the HTTP response contains a SOAP 1.2 fault" do
28
+ http = new_response(:body => Fixture.response(:soap_fault12))
29
+ expect(Savon::SOAPFault.present? http).to be_true
30
+ end
31
+
32
+ it "returns true if the HTTP response contains a SOAP fault with different namespaces" do
33
+ http = new_response(:body => Fixture.response(:another_soap_fault))
34
+ expect(Savon::SOAPFault.present? http).to be_true
35
+ end
36
+
37
+ it "returns false unless the HTTP response contains a SOAP fault" do
38
+ expect(Savon::SOAPFault.present? new_response).to be_false
39
+ end
40
+ end
41
+
42
+ [:message, :to_s].each do |method|
43
+ describe "##{method}" do
44
+ it "returns a SOAP 1.1 fault message" do
45
+ expect(soap_fault.send method).to eq("(soap:Server) Fault occurred while processing.")
46
+ end
47
+
48
+ it "returns a SOAP 1.2 fault message" do
49
+ expect(soap_fault2.send method).to eq("(soap:Sender) Sender Timeout")
50
+ end
51
+
52
+ it "returns a SOAP fault message (with different namespaces)" do
53
+ expect(another_soap_fault.send method).to eq("(ERR_NO_SESSION) Wrong session message")
54
+ end
55
+ end
56
+ end
57
+
58
+ describe "#to_hash" do
59
+ it "returns the SOAP response as a Hash unless a SOAP fault is present" do
60
+ expect(no_fault.to_hash[:authenticate_response][:return][:success]).to be_true
61
+ end
62
+
63
+ it "returns a SOAP 1.1 fault as a Hash" do
64
+ expected = {
65
+ :fault => {
66
+ :faultstring => "Fault occurred while processing.",
67
+ :faultcode => "soap:Server"
68
+ }
69
+ }
70
+
71
+ expect(soap_fault.to_hash).to eq(expected)
72
+ end
73
+
74
+ it "returns a SOAP 1.2 fault as a Hash" do
75
+ expected = {
76
+ :fault => {
77
+ :detail => { :max_time => "P5M" },
78
+ :reason => { :text => "Sender Timeout" },
79
+ :code => { :value => "soap:Sender", :subcode => { :value => "m:MessageTimeout" } }
80
+ }
81
+ }
82
+
83
+ expect(soap_fault2.to_hash).to eq(expected)
84
+ end
85
+ end
86
+
87
+ def new_response(options = {})
88
+ defaults = { :code => 500, :headers => {}, :body => Fixture.response(:authentication) }
89
+ response = defaults.merge options
90
+
91
+ HTTPI::Response.new response[:code], response[:headers], response[:body]
92
+ end
93
+
94
+ end