aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/error_page_test.rb
blob: 0e43700eb6cd492be0dd8584cd43f73b84577523 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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