diff options
| author | Azul <azul@leap.se> | 2014-07-31 08:53:08 +0200 | 
|---|---|---|
| committer | Azul <azul@leap.se> | 2014-07-31 08:53:08 +0200 | 
| commit | 8529177baeb08b96f613148ebef0bf5861d897d1 (patch) | |
| tree | 60c38a2ea626a37311d6ac5e043b6a04624906ed | |
| parent | 3bd643e182e681a047768583b0c2eb2b34f45a2c (diff) | |
respond with 404 and 500 when rendering custom error pages
includes test
| -rw-r--r-- | app/controllers/errors_controller.rb | 2 | ||||
| -rw-r--r-- | test/functional/errors_controller_test.rb | 14 | 
2 files changed, 16 insertions, 0 deletions
| diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index 6c659e6..d869ab5 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -2,9 +2,11 @@  class ErrorsController < ApplicationController    # 404    def not_found +    render status: 404    end    # 500    def server_error +    render status: 500    end  end diff --git a/test/functional/errors_controller_test.rb b/test/functional/errors_controller_test.rb new file mode 100644 index 0000000..e6d2367 --- /dev/null +++ b/test/functional/errors_controller_test.rb @@ -0,0 +1,14 @@ +class ErrorsControllerTest < ActionController::TestCase + +  def test_not_found_resonds_with_404 +    get 'not_found' +    assert_response 404 +    assert_template 'errors/not_found' +  end + +  def test_server_error_resonds_with_500 +    get 'server_error' +    assert_response 500 +    assert_template 'errors/server_error' +  end +end | 
