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