0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 19:36:44 +08:00
discourse/plugins/discourse-zendesk-plugin/spec/integration/topic_extensions_spec.rb
Jarek Radosz 71834c898f
DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073)
Co-authored-by: Loïc Guitaut <loic@discourse.org>
2025-10-06 16:11:01 +02:00

47 lines
1 KiB
Ruby
Vendored

# frozen_string_literal: true
describe "TopicExtensions" do
before { freeze_time }
fab!(:user_1) { Fabricate(:user, admin: true) }
fab!(:topic_1) { Fabricate(:topic, user: user_1) }
context "when an enabled category is set on the topic" do
fab!(:category_1, :category)
before { SiteSetting.zendesk_autogenerate_categories = "#{category_1.id}" }
it "queues a sync job" do
expect_enqueued_with(
job: :zendesk_job,
args: {
topic_id: topic_1.id,
},
at: 5.seconds.from_now,
) do
topic_1.category = category_1
topic_1.save!
end
end
context "when the category is removed" do
before do
topic_1.category = category_1
topic_1.save!
end
it "queues a sync job" do
expect_enqueued_with(
job: :zendesk_job,
args: {
topic_id: topic_1.id,
},
at: 5.seconds.from_now,
) do
topic_1.category = nil
topic_1.save!
end
end
end
end
end