Skip to content

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

FIX: Wrap spec assertion in with_locale as it previously had no translation

Nat8d095630381c
diff --git a/spec/system/content_localization_language_switcher_spec.rb b/spec/system/content_localization_language_switcher_spec.rb
index a237bc354c8..ae97d2d680e 100644
--- a/spec/system/content_localization_language_switcher_spec.rb
+++ b/spec/system/content_localization_language_switcher_spec.rb
@@ -150,9 +150,11 @@ describe "Content localization language switcher", type: :system do
select_language("ja")
expect(topic_list).to have_content("孫子兵法からの人生戦略")
- expect(page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR)["title"]).to eq(
- I18n.t("js.content_localization.toggle_localized.translated"),
- )
+ I18n.with_locale(:ja) do
+ expect(page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR)["title"]).to eq(
+ I18n.t("js.content_localization.toggle_localized.translated"),
+ )
+ end
page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR).click
expect(topic_list).to have_content("Life strategies from The Art of War")
diff --git a/spec/system/content_localization_spec.rb b/spec/system/content_localization_spec.rb
index 709ca703d1f..c6abb6a242e 100644
--- a/spec/system/content_localization_spec.rb
+++ b/spec/system/content_localization_spec.rb
@@ -82,9 +82,11 @@ describe "Content Localization" do
expect(topic_page.has_topic_title?("孫子兵法からの人生戦略")).to eq(true)
- expect(page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR)["title"]).to eq(
- I18n.t("js.content_localization.toggle_localized.translated"),
- )
+ I18n.with_locale(:ja) do
+ expect(page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR)["title"]).to eq(
+ I18n.t("js.content_localization.toggle_localized.translated"),
+ )
+ end
page.find(TOGGLE_LOCALIZE_BUTTON_SELECTOR).click
expect(topic_page.has_topic_title?("Life strategies from The Art of War")).to eq(true)