diff options
author | Steve Klabnik <steve@steveklabnik.com> | 2012-07-05 22:39:15 -0700 |
---|---|---|
committer | Steve Klabnik <steve@steveklabnik.com> | 2012-10-01 21:30:21 -0700 |
commit | 561edbe71ff70abc3c0c63c6c05770b434f9b0a9 (patch) | |
tree | 446a72d24555c382f2d07d7743f245d5f5cb7a9f /actionpack/test/controller | |
parent | cfc0ca0516d818bffdd5959ebe415362965d2de0 (diff) | |
download | rails-561edbe71ff70abc3c0c63c6c05770b434f9b0a9.tar.gz rails-561edbe71ff70abc3c0c63c6c05770b434f9b0a9.tar.bz2 rails-561edbe71ff70abc3c0c63c6c05770b434f9b0a9.zip |
Failsafe exception returns text/plain.
It's best to just return text/plain when something has gone terribly
wrong.
Fixes #5660.
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/show_exceptions_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/test/controller/show_exceptions_test.rb b/actionpack/test/controller/show_exceptions_test.rb index 351b9c4cfa..ab1bd0e3b6 100644 --- a/actionpack/test/controller/show_exceptions_test.rb +++ b/actionpack/test/controller/show_exceptions_test.rb @@ -93,4 +93,20 @@ module ShowExceptions assert_equal 'text/html', response.content_type.to_s end end + + class ShowFailsafeExceptionsTest < ActionDispatch::IntegrationTest + def test_render_failsafe_exception + @app = ShowExceptionsOverridenController.action(:boom) + @exceptions_app = @app.instance_variable_get(:@exceptions_app) + @app.instance_variable_set(:@exceptions_app, nil) + $stderr = StringIO.new + + get '/', {}, 'HTTP_ACCEPT' => 'text/json' + assert_response :internal_server_error + assert_equal 'text/plain', response.content_type.to_s + + @app.instance_variable_set(:@exceptions_app, @exceptions_app) + $stderr = STDERR + end + end end |