diff options
| author | Jon Leighton <j@jonathanleighton.com> | 2010-10-14 10:25:43 +0100 |
|---|---|---|
| committer | Jon Leighton <j@jonathanleighton.com> | 2010-10-14 10:25:43 +0100 |
| commit | 3fb493c2b037ffbdda5c91d66334ec6f79faa2d1 (patch) | |
| tree | e49b072103bbfe6fb6159954c786a31f44099325 /actionpack/test/dispatch | |
| parent | 212fdd8ba9624f61421a7a950283537a3d39ac18 (diff) | |
| parent | 01ab6f961bff150d50c99f03fa3946f48ac29b17 (diff) | |
| download | rails-3fb493c2b037ffbdda5c91d66334ec6f79faa2d1.tar.gz rails-3fb493c2b037ffbdda5c91d66334ec6f79faa2d1.tar.bz2 rails-3fb493c2b037ffbdda5c91d66334ec6f79faa2d1.zip | |
Merge branch 'master' into nested_has_many_through
Conflicts:
activerecord/lib/active_record/associations.rb
activerecord/test/cases/associations/cascaded_eager_loading_test.rb
Diffstat (limited to 'actionpack/test/dispatch')
| -rw-r--r-- | actionpack/test/dispatch/request_test.rb | 12 | ||||
| -rw-r--r-- | actionpack/test/dispatch/show_exceptions_test.rb | 20 |
2 files changed, 32 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 3efed8bef6..04709e5346 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -385,6 +385,18 @@ class RequestTest < ActiveSupport::TestCase assert_equal({"bar" => 2}, request.query_parameters) end + test "parameters still accessible after rack parse error" do + mock_rack_env = { "QUERY_STRING" => "x[y]=1&x[y][][w]=2", "rack.input" => "foo" } + request = nil + begin + request = stub_request(mock_rack_env) + request.parameters + rescue TypeError => e + # rack will raise a TypeError when parsing this query string + end + assert_equal({}, request.parameters) + end + test "formats with accept header" do request = stub_request 'HTTP_ACCEPT' => 'text/html' request.expects(:parameters).at_least_once.returns({}) diff --git a/actionpack/test/dispatch/show_exceptions_test.rb b/actionpack/test/dispatch/show_exceptions_test.rb index ce6c397e32..2a478c214f 100644 --- a/actionpack/test/dispatch/show_exceptions_test.rb +++ b/actionpack/test/dispatch/show_exceptions_test.rb @@ -1,6 +1,7 @@ require 'abstract_unit' class ShowExceptionsTest < ActionDispatch::IntegrationTest + Boomer = lambda do |env| req = ActionDispatch::Request.new(env) case req.path @@ -12,6 +13,8 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest raise ActionController::NotImplemented when "/unprocessable_entity" raise ActionController::InvalidAuthenticityToken + when "/not_found_original_exception" + raise ActionView::Template::Error.new('template', {}, AbstractController::ActionNotFound.new) else raise "puke!" end @@ -101,4 +104,21 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest assert_response 500 assert_match(""foo"=>"[FILTERED]"", body) end + + test "show registered original exception for wrapped exceptions when consider_all_requests_local is false" do + @app = ProductionApp + self.remote_addr = '208.77.188.166' + + get "/not_found_original_exception", {}, {'action_dispatch.show_exceptions' => true} + assert_response 404 + assert_match(/404 error/, body) + end + + test "show registered original exception for wrapped exceptions when consider_all_requests_local is true" do + @app = DevelopmentApp + + get "/not_found_original_exception", {}, {'action_dispatch.show_exceptions' => true} + assert_response 404 + assert_match(/AbstractController::ActionNotFound/, body) + end end |
