From c0f09a8a351a380f377ab3544ea859f4464d27e5 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Thu, 26 May 2011 06:44:48 +0000 Subject: [PATCH] * lib/xmlrpc/parser.rb (FaultException): fix to_s and inspect * test/xmlrpc/parser.rb: test for the above Signed-off-by: URABE, Shyouhei git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/xmlrpc/parser.rb | 3 +-- test/xmlrpc/test_parser.rb | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/xmlrpc/parser.rb b/lib/xmlrpc/parser.rb index 7228c88d6e..eb3c9b3441 100644 --- a/lib/xmlrpc/parser.rb +++ b/lib/xmlrpc/parser.rb @@ -54,11 +54,10 @@ module XMLRPC class FaultException < StandardError attr_reader :faultCode, :faultString - alias message faultString - def initialize(faultCode, faultString) @faultCode = faultCode @faultString = faultString + super(@faultString) end # returns a hash diff --git a/test/xmlrpc/test_parser.rb b/test/xmlrpc/test_parser.rb index 1c50eaed46..0619e87e67 100644 --- a/test/xmlrpc/test_parser.rb +++ b/test/xmlrpc/test_parser.rb @@ -65,6 +65,12 @@ module GenericParserTest assert_equal(fault.faultCode, 4) assert_equal(fault.faultString, "an error message") end + + def test_fault_message + fault = XMLRPC::FaultException.new(1234, 'an error message') + assert_equal('an error message', fault.to_s) + assert_equal('#', fault.inspect) + end end # create test class for each installed parser