aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2011-11-23 23:49:43 +0900
committerkennyj <kennyj@gmail.com>2011-11-24 00:25:34 +0900
commitea70e027b63a1b8bfe4087a4de978ad4eef5575b (patch)
tree4e347f8c65b51733e9df01eb4105c7577b6d7a52 /actionpack/test/dispatch
parenta93ee92da2b9ba83e3a3fe0b8d4dd5cac2790f15 (diff)
downloadrails-ea70e027b63a1b8bfe4087a4de978ad4eef5575b.tar.gz
rails-ea70e027b63a1b8bfe4087a4de978ad4eef5575b.tar.bz2
rails-ea70e027b63a1b8bfe4087a4de978ad4eef5575b.zip
Remove unreachable code, and add additional testcases.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r--actionpack/test/dispatch/request/json_params_parsing_test.rb12
-rw-r--r--actionpack/test/dispatch/request/xml_params_parsing_test.rb12
2 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb
index d854d55173..d481a2df13 100644
--- a/actionpack/test/dispatch/request/json_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb
@@ -45,6 +45,18 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest
end
end
+ test "occurring a parse error if parsing unsuccessful" do
+ with_test_routing do
+ 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} }
+ ensure
+ $stderr = STDERR
+ end
+ end
+ end
+
private
def assert_parses(expected, actual, headers = {})
with_test_routing do
diff --git a/actionpack/test/dispatch/request/xml_params_parsing_test.rb b/actionpack/test/dispatch/request/xml_params_parsing_test.rb
index 38453dfe48..65a25557b7 100644
--- a/actionpack/test/dispatch/request/xml_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/xml_params_parsing_test.rb
@@ -67,6 +67,18 @@ class XmlParamsParsingTest < ActionDispatch::IntegrationTest
end
end
+ test "occurring a parse error if parsing unsuccessful" do
+ with_test_routing do
+ 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) }
+ ensure
+ $stderr = STDERR
+ end
+ end
+ end
+
test "parses multiple files" do
xml = <<-end_body
<person>