From f9f1ab4e3ddeacadf2a7bce021d742f08f67905f Mon Sep 17 00:00:00 2001 From: "Hongli Lai (Phusion" Date: Thu, 10 Jul 2008 13:21:08 +0200 Subject: When an unexpected exception is caught, tell the administrator to read the log file for more information about the error. This should make things less confusing for developers who are new to Rails. Signed-off-by: Michael Koziarski --- railties/html/500.html | 2 ++ railties/test/error_page_test.rb | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 railties/test/error_page_test.rb (limited to 'railties') diff --git a/railties/html/500.html b/railties/html/500.html index 0e9c14f4c6..328fdcc3bc 100644 --- a/railties/html/500.html +++ b/railties/html/500.html @@ -25,6 +25,8 @@

We're sorry, but something went wrong.

We've been notified about this issue and we'll take a look at it shortly.

+

(If you're the administrator of this website, then please read + the log file "<%=h RAILS_ENV %>.log" to find out what went wrong.)

\ No newline at end of file diff --git a/railties/test/error_page_test.rb b/railties/test/error_page_test.rb new file mode 100644 index 0000000000..0e43700eb6 --- /dev/null +++ b/railties/test/error_page_test.rb @@ -0,0 +1,37 @@ +require 'abstract_unit' +require 'action_controller' +require 'action_controller/test_process' + +RAILS_ENV = "test" + +module Rails + def self.public_path + File.expand_path(File.join(File.dirname(__FILE__), "..", "html")) + end +end + +class ErrorPageController < ActionController::Base + def crash + raise StandardError, "crash!" + end +end + +ActionController::Routing::Routes.draw do |map| + map.connect ':controller/:action/:id' +end + +class ErrorPageControllerTest < Test::Unit::TestCase + def setup + @controller = ErrorPageController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + + ActionController::Base.consider_all_requests_local = false + end + + def test_500_error_page_instructs_system_administrator_to_check_log_file + get :crash + expected_log_file = "#{RAILS_ENV}.log" + assert_not_nil @response.body.index(expected_log_file) + end +end -- cgit v1.2.3