提交 f9f1ab4e 编写于 作者: H Hongli Lai (Phusion 提交者: Michael Koziarski

When an unexpected exception is caught, tell the administrator to read the log...

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: NMichael Koziarski <michael@koziarski.com>
上级 eec5eb2e
......@@ -25,6 +25,8 @@
<div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
<p><small>(If you're the administrator of this website, then please read
the log file "<%=h RAILS_ENV %>.log" to find out what went wrong.)</small></p>
</div>
</body>
</html>
\ No newline at end of file
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册