aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorHongli Lai (Phusion <hongli@phusion.nl>2008-07-10 13:21:08 +0200
committerMichael Koziarski <michael@koziarski.com>2008-08-26 14:30:19 +0200
commitf9f1ab4e3ddeacadf2a7bce021d742f08f67905f (patch)
tree994a4d44905a910bc70d663a7e89860d799c2e30 /railties/test
parenteec5eb2e444b2b42206e2d5ccfe7f30306c308cb (diff)
downloadrails-f9f1ab4e3ddeacadf2a7bce021d742f08f67905f.tar.gz
rails-f9f1ab4e3ddeacadf2a7bce021d742f08f67905f.tar.bz2
rails-f9f1ab4e3ddeacadf2a7bce021d742f08f67905f.zip
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 <michael@koziarski.com>
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/error_page_test.rb37
1 files changed, 37 insertions, 0 deletions
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