Skip to content

Commit

Permalink
HOTT-4630: Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
willfish committed Dec 22, 2023
1 parent 0faabd8 commit 309d354
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
7 changes: 0 additions & 7 deletions app/controllers/errors_controller.rb
Expand Up @@ -3,7 +3,6 @@ class ErrorsController < ApplicationController

helper_method :user_session

# /400
def bad_request
message = "The request you made is not valid.<br>
Please contact support for assistance or try a different request.".html_safe
Expand All @@ -15,7 +14,6 @@ def bad_request
end
end

# /404
def not_found
message = 'You may have mistyped the address or the page may have moved.'

Expand All @@ -26,7 +24,6 @@ def not_found
end
end

# /405
def method_not_allowed
message = "We're sorry, but this request method is not supported.<br>
Please contact support for assistance or try a different request.".html_safe
Expand All @@ -38,7 +35,6 @@ def method_not_allowed
end
end

# /406
def not_acceptable
message = "Unfortunately, we cannot fulfill your request as it is not in a format we can accept.<br>
Please contact support for assistance or try a different request.".html_safe
Expand All @@ -50,7 +46,6 @@ def not_acceptable
end
end

# /422
def unprocessable_entity
message = "Maybe you tried to change something you didn't have access to."

Expand All @@ -64,7 +59,6 @@ def unprocessable_entity
end
end

# /500
def internal_server_error
message = 'We could not proceed with calculating your duty.'

Expand All @@ -78,7 +72,6 @@ def internal_server_error
end
end

# /501
def not_implemented
message = 'We\'re sorry, but the requested action is not supported by our server at this time.<br>
Please contact support for assistance or try a different request.'.html_safe
Expand Down
5 changes: 3 additions & 2 deletions config/environments/test.rb
Expand Up @@ -20,11 +20,12 @@
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
"Cache-Control" => "public, max-age=#{1.hour.to_i}",
}

# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.consider_all_requests_local = false
config.action_dispatch.show_exceptions = true
config.action_controller.perform_caching = false
config.cache_store = :null_store

Expand Down
4 changes: 0 additions & 4 deletions spec/requests/errors_controller_spec.rb
Expand Up @@ -12,8 +12,6 @@
it { expect(json_response).to include 'error' => message }
end

# Tests Json error responses

describe 'GET /400.json' do
let(:make_request) { get '/400.json' }

Expand Down Expand Up @@ -56,8 +54,6 @@
it_behaves_like 'a json error response', 501, 'Not implemented'
end

# Test html error responses

describe 'GET /400' do
let(:make_request) { get '/400' }

Expand Down

0 comments on commit 309d354

Please sign in to comment.