aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/request
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-09-26 10:55:29 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-09-26 10:55:29 -0700
commit8156178894dc6c57aca50a4d5f6c9398beb5f3e0 (patch)
tree485ef273dfeb2c610a0225d0261ef95eb65c5045 /actionpack/test/dispatch/request
parentd36f57f430c011e889c7d45335beea4ea0dc9769 (diff)
parentfd99bb892652b1ffffdd7f9271184235d6040111 (diff)
downloadrails-8156178894dc6c57aca50a4d5f6c9398beb5f3e0.tar.gz
rails-8156178894dc6c57aca50a4d5f6c9398beb5f3e0.tar.bz2
rails-8156178894dc6c57aca50a4d5f6c9398beb5f3e0.zip
Merge pull request #7444 from szimek/params_parser_raises_parsing_error
Raise generic ParseError exception when ParamsParser fails parsing request params
Diffstat (limited to 'actionpack/test/dispatch/request')
-rw-r--r--actionpack/test/dispatch/request/json_params_parsing_test.rb4
-rw-r--r--actionpack/test/dispatch/request/xml_params_parsing_test.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb
index 302bff0696..c0c3147e37 100644
--- a/actionpack/test/dispatch/request/json_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb
@@ -46,7 +46,9 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest
begin
$stderr = StringIO.new # suppress the log
json = "[\"person]\": {\"name\": \"David\"}}"
- assert_raise(MultiJson::DecodeError) { 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_equal MultiJson::DecodeError, exception.original_exception.class
+ assert_equal exception.original_exception.message, 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 84823e2896..cb68667002 100644
--- a/actionpack/test/dispatch/request/xml_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/xml_params_parsing_test.rb
@@ -68,7 +68,9 @@ class XmlParamsParsingTest < ActionDispatch::IntegrationTest
begin
$stderr = StringIO.new # suppress the log
xml = "<person><name>David</name></pineapple>"
- assert_raise(REXML::ParseException) { 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_equal REXML::ParseException, exception.original_exception.class
+ assert_equal exception.original_exception.message, exception.message
ensure
$stderr = STDERR
end