Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
KludgeKML committed Nov 26, 2024
1 parent 08c23a3 commit c07770b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions app/controllers/static_error_pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
class StaticErrorPagesController < ApplicationController
after_action do
response.headers[Slimmer::Headers::SKIP_HEADER] = "true"
end

ERROR_CODES = %w[
400
401
Expand Down
16 changes: 8 additions & 8 deletions spec/system/static_error_page_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
RSpec.describe "Static Error Pages" do
context "When asked for a 4xx template" do
it "renders the 400 template" do
context "When asked for a 4xx page" do
it "renders the appropriate page" do
visit "/static-error-pages/404.html"

within "head", visible: :all do
expect(page).to have_selector("title", text: "Page not found - GOV.UK", visible: :all)
expect(page).to have_selector("link[href$='application.css']", visible: :all)
# expect(page).to have_selector("link[href$='application.css']", visible: :all)
end

within "body" do
Expand All @@ -23,17 +23,17 @@
end
end

expect(page).to have_selector("script[src$='application.js']", visible: :all)
# expect(page).to have_selector("script[src$='application.js']", visible: :all)
end
end

context "When asked for a 5xx template" do
it "renders the 500 template" do
context "When asked for a 5xx patge" do
it "renders the appropriate page" do
visit "/static-error-pages/500.html"

within "head", visible: :all do
expect(page).to have_selector("title", text: "Sorry, we’re experiencing technical difficulties - GOV.UK", visible: :all)
expect(page).to have_selector("link[href$='application.css']", visible: :all)
# expect(page).to have_selector("link[href$='application.css']", visible: :all)
end

within "body" do
Expand All @@ -51,7 +51,7 @@
end
end

expect(page).to have_selector("script[src$='application.js']", visible: :all)
# expect(page).to have_selector("script[src$='application.js']", visible: :all)
end
end
end

0 comments on commit c07770b

Please sign in to comment.