Skip to content

A platform for community discussion. Free, open, simple.

DEV: Rework a couple of specs to avoid state leak (#35410)

Osama Sayeghc091f109f9bc
diff --git a/spec/requests/application_controller_spec.rb b/spec/requests/application_controller_spec.rb
index e49806fe205..96cae02335d 100644
--- a/spec/requests/application_controller_spec.rb
+++ b/spec/requests/application_controller_spec.rb
@@ -443,9 +443,10 @@ RSpec.describe ApplicationController do
end
it "should allow anchor tags in title" do
- I18n.backend.store_translations(
- :en,
- { page_not_found: { title: 'Visit <a href="/search">search</a> page' } },
+ TranslationOverride.upsert!(
+ I18n.locale,
+ "page_not_found.title",
+ 'Visit <a href="/search">search</a> page',
)
get "/t/nope-nope/99999999"
@@ -454,9 +455,10 @@ RSpec.describe ApplicationController do
end
it "should sanitize unsafe HTML in title" do
- I18n.backend.store_translations(
- :en,
- { page_not_found: { title: 'Page <script>alert("xss")</script> not found' } },
+ TranslationOverride.upsert!(
+ I18n.locale,
+ "page_not_found.title",
+ 'Page <script>alert("xss")</script> not found',
)
get "/t/nope-nope/99999999"