Upgrade to Rails 2.2.0
As a side benefit, fix an (non-user-visible) bug in display_s5(). Also fixed a bug where removing orphaned pages did not expire cached summary pages.
This commit is contained in:
parent
39348c65c2
commit
7600aef48b
827 changed files with 123652 additions and 11027 deletions
43
vendor/rails/railties/test/error_page_test.rb
vendored
Normal file
43
vendor/rails/railties/test/error_page_test.rb
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
require 'abstract_unit'
|
||||
require 'action_controller'
|
||||
require 'action_controller/test_process'
|
||||
|
||||
RAILS_ENV = "test"
|
||||
CURRENT_DIR = File.expand_path(File.dirname(__FILE__))
|
||||
HTML_DIR = File.expand_path(File.join(CURRENT_DIR, "..", "html"))
|
||||
|
||||
module Rails
|
||||
def self.public_path
|
||||
CURRENT_DIR
|
||||
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
|
||||
template = ERB.new(File.read(File.join(HTML_DIR, "500.html")))
|
||||
File.open(File.join(CURRENT_DIR, "500.html"), "w") do |f|
|
||||
f.write(template.result)
|
||||
end
|
||||
get :crash
|
||||
expected_log_file = "#{RAILS_ENV}.log"
|
||||
assert_not_nil @response.body.index(expected_log_file)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue