FEATURE: Merge discourse-automation (#26432)

Automation (previously known as discourse-automation) is now a core plugin.
This commit is contained in:
Osama Sayegh
2024-04-03 18:20:43 +03:00
committed by GitHub
parent 2190c9b957
commit 3d4faf3272
314 changed files with 21182 additions and 10 deletions

View File

@ -0,0 +1,31 @@
# frozen_string_literal: true
require_relative "../discourse_automation_helper"
describe "TopicRequiredWords" do
fab!(:user)
fab!(:topic)
fab!(:automation) do
Fabricate(
:automation,
script: DiscourseAutomation::Scripts::TOPIC_REQUIRED_WORDS,
trigger: DiscourseAutomation::Triggers::TOPIC,
)
end
context "when updating trigger" do
it "updates the custom field" do
automation.upsert_field!("restricted_topic", "text", { value: topic.id }, target: "trigger")
expect(topic.custom_fields["discourse_automation_ids"]).to eq([automation.id])
new_topic = create_topic
automation.upsert_field!(
"restricted_topic",
"text",
{ value: new_topic.id },
target: "trigger",
)
expect(new_topic.custom_fields["discourse_automation_ids"]).to eq([automation.id])
end
end
end