2021-02-09 13:41:22 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.describe Jobs::PostUpdateTopicTrackingState do
|
2023-06-21 22:00:19 +08:00
|
|
|
subject(:job) { described_class.new }
|
|
|
|
|
2023-11-10 06:47:59 +08:00
|
|
|
fab!(:post)
|
2021-02-09 13:41:22 +08:00
|
|
|
|
|
|
|
it "should publish messages" do
|
2023-06-21 22:00:19 +08:00
|
|
|
messages = MessageBus.track_publish { job.execute({ post_id: post.id }) }
|
2021-02-09 13:41:22 +08:00
|
|
|
expect(messages.size).not_to eq(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should not publish messages for deleted topics" do
|
|
|
|
post.topic.trash!
|
2023-06-21 22:00:19 +08:00
|
|
|
messages = MessageBus.track_publish { job.execute({ post_id: post.id }) }
|
2021-02-09 13:41:22 +08:00
|
|
|
expect(messages.size).to eq(0)
|
|
|
|
end
|
|
|
|
end
|