From b6ba012032c0c53e4539228b06f3da6d6a5a69bc Mon Sep 17 00:00:00 2001 From: Szymon Nowak Date: Fri, 24 Aug 2012 21:55:41 +0200 Subject: Fix ActionDispatch::ParamsParser::ParseError message for XML and JSON parsers. --- actionpack/test/dispatch/request/json_params_parsing_test.rb | 3 ++- actionpack/test/dispatch/request/xml_params_parsing_test.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb index f7f621df71..2022586912 100644 --- a/actionpack/test/dispatch/request/json_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb @@ -46,7 +46,8 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest begin $stderr = StringIO.new # suppress the log json = "[\"person]\": {\"name\": \"David\"}}" - assert_raise(ActionDispatch::ParamsParser::ParseError) { post "/parse", json, {'CONTENT_TYPE' => 'application/json', 'action_dispatch.show_exceptions' => false} } + exception = assert_raise(ActionDispatch::ParamsParser::ParseError) { post "/parse", json, {'CONTENT_TYPE' => 'application/json', 'action_dispatch.show_exceptions' => false} } + assert_match json, exception.message ensure $stderr = STDERR end diff --git a/actionpack/test/dispatch/request/xml_params_parsing_test.rb b/actionpack/test/dispatch/request/xml_params_parsing_test.rb index 0fcae1e650..1ef2195810 100644 --- a/actionpack/test/dispatch/request/xml_params_parsing_test.rb +++ b/actionpack/test/dispatch/request/xml_params_parsing_test.rb @@ -68,7 +68,8 @@ class XmlParamsParsingTest < ActionDispatch::IntegrationTest begin $stderr = StringIO.new # suppress the log xml = "David" - assert_raise(ActionDispatch::ParamsParser::ParseError) { post "/parse", xml, default_headers.merge('action_dispatch.show_exceptions' => false) } + exception = assert_raise(ActionDispatch::ParamsParser::ParseError) { post "/parse", xml, default_headers.merge('action_dispatch.show_exceptions' => false) } + assert_match xml, exception.message ensure $stderr = STDERR end -- cgit v1.2.3