Skip to content

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

DEV: Wrap specs in appropriate locale (#38056)

Natalie Tayfda96d735120
diff --git a/spec/system/content_localization_language_switcher_spec.rb b/spec/system/content_localization_language_switcher_spec.rb
index ae97d2d680e..168cc7c46c1 100644
--- a/spec/system/content_localization_language_switcher_spec.rb
+++ b/spec/system/content_localization_language_switcher_spec.rb
@@ -158,9 +158,11 @@ describe "Content localization language switcher", type: :system do
page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR).click
expect(topic_list).to have_content("Life strategies from The Art of War")
- expect(page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR)["title"]).to eq(
- I18n.t("js.content_localization.toggle_localized.not_translated"),
- )
+ I18n.with_locale(:ja) do
+ expect(page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR)["title"]).to eq(
+ I18n.t("js.content_localization.toggle_localized.not_translated"),
+ )
+ end
select_language("es")
diff --git a/spec/system/content_localization_spec.rb b/spec/system/content_localization_spec.rb
index c6abb6a242e..5b8a0978bc8 100644
--- a/spec/system/content_localization_spec.rb
+++ b/spec/system/content_localization_spec.rb
@@ -90,10 +90,11 @@ describe "Content Localization" do
page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR).click
expect(topic_page.has_topic_title?("Life strategies from The Art of War")).to eq(true)
- expect(page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR)["title"]).to eq(
- I18n.t("js.content_localization.toggle_localized.not_translated"),
- )
-
+ I18n.with_locale(:ja) do
+ expect(page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR)["title"]).to eq(
+ I18n.t("js.content_localization.toggle_localized.not_translated"),
+ )
+ end
visit("/")
topic_list.visit_topic_with_title("Life strategies from The Art of War")
end