Paul Robert Lloyd
3 years ago
10 changed files with 72 additions and 9 deletions
@ -0,0 +1,25 @@ |
|||||||
|
class ErrorsController < ApplicationController |
||||||
|
skip_before_action :verify_authenticity_token |
||||||
|
|
||||||
|
def not_found |
||||||
|
respond_to do |format| |
||||||
|
format.html { render status: :not_found } |
||||||
|
format.json { render json: { error: "Resource not found" }, status: :not_found } |
||||||
|
format.all { render status: :not_found, body: nil } |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
def internal_server_error |
||||||
|
respond_to do |format| |
||||||
|
format.html { render status: :internal_server_error } |
||||||
|
format.json { render json: { error: "Internal server error" }, status: :internal_server_error } |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
def unprocessable_entity |
||||||
|
respond_to do |format| |
||||||
|
format.html { render status: :unprocessable_entity } |
||||||
|
format.json { render json: { error: "Unprocessable entity" }, status: :unprocessable_entity } |
||||||
|
end |
||||||
|
end |
||||||
|
end |
@ -1,6 +1,8 @@ |
|||||||
|
<% content_for :title, "Sorry, there is a problem with the service" %> |
||||||
|
|
||||||
<div class="govuk-grid-row"> |
<div class="govuk-grid-row"> |
||||||
<div class="govuk-grid-column-two-thirds"> |
<div class="govuk-grid-column-two-thirds"> |
||||||
<h1 class="govuk-heading-l">Sorry, there is a problem with the service</h1> |
<h1 class="govuk-heading-l"><%= content_for(:title) %></h1> |
||||||
<p class="govuk-body">Try again later.</p> |
<p class="govuk-body">Try again later.</p> |
||||||
</div> |
</div> |
||||||
</div> |
</div> |
@ -1,6 +1,8 @@ |
|||||||
|
<% content_for :title, "Page not found" %> |
||||||
|
|
||||||
<div class="govuk-grid-row"> |
<div class="govuk-grid-row"> |
||||||
<div class="govuk-grid-column-two-thirds"> |
<div class="govuk-grid-column-two-thirds"> |
||||||
<h1 class="govuk-heading-l">Page not found</h1> |
<h1 class="govuk-heading-l"><%= content_for(:title) %></h1> |
||||||
<p class="govuk-body">If you typed the web address, check it is correct.</p> |
<p class="govuk-body">If you typed the web address, check it is correct.</p> |
||||||
<p class="govuk-body">If you pasted the web address, check you copied the entire address.</p> |
<p class="govuk-body">If you pasted the web address, check you copied the entire address.</p> |
||||||
<p class="govuk-body"><a class="govuk-link" href="https://digital.dclg.gov.uk/jira/servicedesk/customer/portal/4/group/21">Get help</a> if the web address is correct and not working.</p> |
<p class="govuk-body"><a class="govuk-link" href="https://digital.dclg.gov.uk/jira/servicedesk/customer/portal/4/group/21">Get help</a> if the web address is correct and not working.</p> |
@ -1,6 +1,8 @@ |
|||||||
|
<% content_for :title, "Sorry, there is a problem with the service" %> |
||||||
|
|
||||||
<div class="govuk-grid-row"> |
<div class="govuk-grid-row"> |
||||||
<div class="govuk-grid-column-two-thirds"> |
<div class="govuk-grid-column-two-thirds"> |
||||||
<h1 class="govuk-heading-l">Sorry, there is a problem with the service</h1> |
<h1 class="govuk-heading-l"><%= content_for(:title) %></h1> |
||||||
<p class="govuk-body">Try again later.</p> |
<p class="govuk-body">Try again later.</p> |
||||||
</div> |
</div> |
||||||
</div> |
</div> |
@ -0,0 +1,24 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe ErrorsController, type: :controller do |
||||||
|
describe "GET #not_found" do |
||||||
|
it "returns not found" do |
||||||
|
get :not_found |
||||||
|
expect(response).to have_http_status(:not_found) |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
describe "GET #internal_server_error" do |
||||||
|
it "returns internal_server_error" do |
||||||
|
get :internal_server_error |
||||||
|
expect(response).to have_http_status(:internal_server_error) |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
describe "GET #unprocessable_entity" do |
||||||
|
it "returns unprocessable_entity" do |
||||||
|
get :unprocessable_entity |
||||||
|
expect(response).to have_http_status(:unprocessable_entity) |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue