From a51beb03465d6264cb7030b4400644f7e80219cf Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Tue, 26 Feb 2013 15:59:47 +1100 Subject: [PATCH] added test for #500 --- test/helpers_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/helpers_test.rb b/test/helpers_test.rb index 8bf87b8a..03e86b23 100644 --- a/test/helpers_test.rb +++ b/test/helpers_test.rb @@ -303,6 +303,18 @@ class HelpersTest < Test::Unit::TestCase assert_equal 'error handler', body end + it 'should not reset the content-type to html for error handlers' do + mock_app do + disable :raise_errors + before { content_type "application/json;charset=utf-8" } + not_found { JSON.dump("error" => "Not Found") } + end + + get '/' + assert_equal 404, status + assert_equal 'application/json;charset=utf-8', response.content_type + end + it 'should not invoke error handler when halting with 500 inside an error handler' do mock_app do disable :raise_errors