Skip to content

Commit

Permalink
Merge pull request #7483 from ministryofjustice/chore/fix-welsh-local…
Browse files Browse the repository at this point in the history
…e-flicker

Chore: Fix Welsh locale flicker
  • Loading branch information
colinbruce authored Nov 27, 2024
2 parents 5bdb776 + ef3127f commit 3f1d0a2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
14 changes: 7 additions & 7 deletions spec/requests/errors_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end
end

context "with Welsh locale" do
context "with Welsh locale", :use_welsh_locale do
it "displays the correct content" do
get("/unknown/path", params: { locale: :cy })
expect(page)
Expand All @@ -44,7 +44,7 @@
end
end

context "with Welsh locale" do
context "with Welsh locale", :use_welsh_locale do
it "displays the correct content" do
get feedback_path(SecureRandom.uuid, locale: :cy)
expect(page)
Expand Down Expand Up @@ -72,7 +72,7 @@
end
end

context "with Welsh locale" do
context "with Welsh locale", :use_welsh_locale do
it "displays the correct content" do
get feedback_path(SecureRandom.uuid, locale: :cy)
expect(page)
Expand Down Expand Up @@ -102,7 +102,7 @@
.and have_content("If you pasted the web address, check you copied the entire address.")
end

context "with Welsh locale" do
context "with Welsh locale", :use_welsh_locale do
it "displays the correct content" do
get error_path(:page_not_found, locale: :cy)
expect(page)
Expand All @@ -129,7 +129,7 @@
expect(page).to have_css("h1", text: "You've already shared your financial information")
end

context "with Welsh locale" do
context "with Welsh locale", :use_welsh_locale do
it "displays the correct content" do
get error_path(:assessment_already_completed, locale: :cy)
expect(page)
Expand All @@ -156,7 +156,7 @@
expect(page).to have_css("h1", text: "Access denied")
end

context "with Welsh locale" do
context "with Welsh locale", :use_welsh_locale do
it "displays the correct content" do
get error_path(:access_denied, locale: :cy)
expect(page)
Expand Down Expand Up @@ -184,7 +184,7 @@
.to have_css("h1", text: "Sorry, something went wrong with our service")
end

context "with Welsh locale" do
context "with Welsh locale", :use_welsh_locale do
it "displays the correct content" do
get error_path(:internal_server_error, locale: :cy)
expect(page)
Expand Down
9 changes: 9 additions & 0 deletions spec/support/welsh_language.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
RSpec.configure do |config|
config.around do |example|
if example.metadata[:use_welsh_locale] == true
I18n.with_locale(:cy) { example.run }
else
example.run
end
end
end

0 comments on commit 3f1d0a2

Please sign in to comment.