Permalink
Browse files

Some small cleanups.

  • Loading branch information...
1 parent cd30d79 commit 69ba29fc212a0fe369bba5a566302279b85a386d @alloy alloy committed Aug 24, 2011
Showing with 4 additions and 12 deletions.
  1. +2 −10 lib/adyen/api/simple_soap_client.rb
  2. +2 −2 spec/api/response_spec.rb
View
12 lib/adyen/api/simple_soap_client.rb
@@ -32,25 +32,17 @@ def initialize(response, action, endpoint)
def message_prefix
%{[#{@response.http_response.code} #{@response.http_response.message}] A %s error occurred while calling SOAP action `#{@action}' on endpoint `#{@endpoint}'.}
end
-
- def client_error_template
- "#{message_prefix % "client"} Fault message: #{@response.fault_message}."
- end
-
- def server_error_template
- message_prefix % 'server'
- end
end
class ClientError < StandardError
def message
- client_error_template
+ "#{message_prefix % "client"} Fault message: #{@response.fault_message}."
end
end
class ServerError < StandardError
def message
- server_error_template
+ message_prefix % 'server'
end
end
View
4 spec/api/response_spec.rb
@@ -33,7 +33,7 @@
end
end
- describe "with a failed HTTP response and no SOAP fault message" do
+ describe "with a server error HTTP response and _no_ SOAP fault message" do
before do
http_response = Net::HTTPServerError.new('1.1', '500', 'Internal Server Error')
http_response.stub!(:body).and_return(%{<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"><soap:Body></soap:Body></soap:Envelope>})
@@ -45,7 +45,7 @@
end
end
- describe "with a failed HTTP response and no SOAP fault message" do
+ describe "with a server error HTTP response _and_ SOAP fault message" do
before do
http_response = Net::HTTPServerError.new('1.1', '500', 'Internal Server Error')
http_response.stub!(:body).and_return(%{<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"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Illegal argument. For input string: "100.0"</faultstring></soap:Fault></soap:Body></soap:Envelope>})

0 comments on commit 69ba29f

Please sign in to comment.