Permalink
Browse files

Failsafe doesn't return bare String body

  • Loading branch information...
1 parent 05abd7c commit 91fbdfd5b3a0c664e1b80c88e3f60235ac8f7b0e @jeremy jeremy committed Jun 9, 2009
View
2 actionpack/lib/action_controller/failsafe.rb
@@ -36,7 +36,7 @@ def call(env)
private
def failsafe_response(exception)
log_failsafe_exception(exception)
- [500, {'Content-Type' => 'text/html'}, failsafe_response_body]
+ [500, {'Content-Type' => 'text/html'}, [failsafe_response_body]]
rescue Exception => failsafe_error # Logger or IO errors
$stderr.puts "Error during failsafe response: #{failsafe_error}"
end
View
2 actionpack/test/controller/dispatcher_test.rb
@@ -56,7 +56,7 @@ def test_failsafe_response
assert_equal 3, response.size
assert_equal 500, response[0]
assert_equal({"Content-Type" => "text/html"}, response[1])
- assert_match /500 Internal Server Error/, response[2]
+ assert_match /500 Internal Server Error/, response[2].join
end
def test_prepare_callbacks
View
8 actionpack/test/controller/failsafe_test.rb
@@ -46,15 +46,15 @@ def test_renders_error_page_file_with_erb
app_will_raise_error!
response = @failsafe.call({})
assert_equal 500, response[0]
- assert_equal "hello my world", response[2]
+ assert_equal "hello my world", response[2].join
end
def test_returns_a_default_message_if_erb_rendering_failed
app_will_raise_error!
@failsafe.expects(:render_template).raises(RuntimeError.new("Harddisk is crashing"))
response = @failsafe.call({})
assert_equal 500, response[0]
- assert_match /500 Internal Server Error/, response[2]
- assert_match %r(please read this web application's log file), response[2]
+ assert_match /500 Internal Server Error/, response[2].join
+ assert_match %r(please read this web application's log file), response[2].join
end
-end
+end

0 comments on commit 91fbdfd

Please sign in to comment.