mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Catch missing translations during test runs (#26258)
This configuration makes it so that a missing translation will raise an error during test execution. Better discover there than after deploy.
This commit is contained in:
@@ -3,7 +3,26 @@
|
||||
describe DiscourseAutomation::AdminAutomationsController do
|
||||
fab!(:automation)
|
||||
|
||||
before { SiteSetting.discourse_automation_enabled = true }
|
||||
before do
|
||||
SiteSetting.discourse_automation_enabled = true
|
||||
I18n.backend.store_translations(
|
||||
:en,
|
||||
{
|
||||
discourse_automation: {
|
||||
scriptables: {
|
||||
something_about_us: {
|
||||
title: "Something about us.",
|
||||
description: "We rock!",
|
||||
},
|
||||
},
|
||||
triggerables: {
|
||||
title: "Triggerables",
|
||||
description: "Triggerables",
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
end
|
||||
|
||||
describe "#show" do
|
||||
context "when logged in as an admin" do
|
||||
|
||||
@@ -41,6 +41,19 @@ describe DiscourseAutomation::AutomationSerializer do
|
||||
DiscourseAutomation::Scriptable.add("foo") do
|
||||
field :bar, component: :text, triggerable: DiscourseAutomation::Triggers::TOPIC
|
||||
end
|
||||
I18n.backend.store_translations(
|
||||
:en,
|
||||
{
|
||||
discourse_automation: {
|
||||
scriptables: {
|
||||
foo: {
|
||||
title: "Something about us.",
|
||||
description: "We rock!",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
end
|
||||
|
||||
context "when automation is not using the specific trigger" do
|
||||
|
||||
@@ -6,6 +6,34 @@ describe "DiscourseAutomation | smoke test", type: :system, js: true do
|
||||
fab!(:badge) { Fabricate(:badge, name: "badge") }
|
||||
|
||||
before do
|
||||
I18n.backend.store_translations(
|
||||
:en,
|
||||
{
|
||||
discourse_automation: {
|
||||
scriptables: {
|
||||
test: {
|
||||
title: "Test",
|
||||
description: "Test",
|
||||
},
|
||||
something_about_us: {
|
||||
title: "Something about us.",
|
||||
description: "We rock!",
|
||||
},
|
||||
nothing_about_us: {
|
||||
title: "Nothing about us.",
|
||||
description: "We don't rock!",
|
||||
},
|
||||
},
|
||||
triggerables: {
|
||||
title: "Triggerable",
|
||||
description: "Triggerable",
|
||||
user_first_logged_in: {
|
||||
description: "User first logged in.",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
SiteSetting.discourse_automation_enabled = true
|
||||
sign_in(admin)
|
||||
end
|
||||
|
||||
@@ -23,6 +23,19 @@ describe "StalledWiki" do
|
||||
before do
|
||||
automation.upsert_field!("stalled_after", "choices", { value: "PT10H" }, target: "trigger")
|
||||
automation.upsert_field!("retriggered_after", "choices", { value: "PT1H" }, target: "trigger")
|
||||
I18n.backend.store_translations(
|
||||
:en,
|
||||
{
|
||||
discourse_automation: {
|
||||
scriptables: {
|
||||
something_about_us: {
|
||||
title: "Something about us.",
|
||||
description: "We rock!",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
end
|
||||
|
||||
it "supports manual triggering" do
|
||||
|
||||
@@ -615,7 +615,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
|
||||
it "should not trigger the bot" do
|
||||
post.update!(
|
||||
raw:
|
||||
"`@discobot #{I18n.t("discourse_narrative_bot.track_selector.reset_trigger")} #{I18n.t(DiscourseNarrativeBot::NewUserNarrative.reset_trigger)}`",
|
||||
"`@discobot #{I18n.t("discourse_narrative_bot.track_selector.reset_trigger")} #{DiscourseNarrativeBot::NewUserNarrative.reset_trigger}`",
|
||||
)
|
||||
|
||||
expect { described_class.new(:reply, user, post_id: post.id).select }.to_not change {
|
||||
@@ -750,7 +750,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
|
||||
user: Fabricate(:user),
|
||||
topic: topic,
|
||||
raw:
|
||||
"@discobot #{I18n.t("discourse_narrative_bot.track_selector.reset_trigger")} #{I18n.t(DiscourseNarrativeBot::NewUserNarrative.reset_trigger)}",
|
||||
"@discobot #{I18n.t("discourse_narrative_bot.track_selector.reset_trigger")} #{DiscourseNarrativeBot::NewUserNarrative.reset_trigger}",
|
||||
)
|
||||
|
||||
user
|
||||
|
||||
Reference in New Issue
Block a user