Skip to content

Commit

Permalink
Tests: errors_controller_test.rb
Browse files Browse the repository at this point in the history
Fixes #612
  • Loading branch information
ewlarson committed Sep 23, 2024
1 parent 951f77a commit f75d778
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 151 deletions.
6 changes: 0 additions & 6 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,4 @@ def allow_geoblacklight_params
def after_message_create_path
main_app.try(:root_path) || '/'
end

protected

def not_found
raise ActionController::RoutingError.new('Not Found')
end
end
6 changes: 3 additions & 3 deletions app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class ErrorsController < ApplicationController
def not_found
render status: 404, layout: 'blacklight', template: 'errors/not_found.html.erb'
render 'errors/not_found', status: :not_found
end

def internal_server_error
render status: 500, layout: 'blacklight', template: 'errors/internal_server_error.html.erb'
render 'errors/internal_server_error', status: :internal_server_error
end
end
end
67 changes: 0 additions & 67 deletions public/404.html

This file was deleted.

66 changes: 0 additions & 66 deletions public/500.html

This file was deleted.

14 changes: 5 additions & 9 deletions test/controllers/errors_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
require 'test_helper'

class ErrorsControllerTest < ActionDispatch::IntegrationTest
test "bad facet id should return not_found" do
assert_raises(ActionController::RoutingError) do
get '/catalog/facet/about'
end
end

test "should get not_found" do
get '/404'
assert_response :success
assert_response :not_found
assert_template 'errors/not_found'
end

test "should get internal_server_error" do
get '/500'
assert_response :success
assert_response :internal_server_error
assert_template 'errors/internal_server_error'
end
end
end

0 comments on commit f75d778

Please sign in to comment.