correct erratic spec

correct erratic spec

diff --git a/spec/jobs/publish_topic_to_category_spec.rb b/spec/jobs/publish_topic_to_category_spec.rb
index 2090b31..ebb5e79 100644
--- a/spec/jobs/publish_topic_to_category_spec.rb
+++ b/spec/jobs/publish_topic_to_category_spec.rb
@@ -50,7 +50,9 @@ RSpec.describe Jobs::PublishTopicToCategory do
 
     message = MessageBus.track_publish do
       described_class.new.execute(topic_timer_id: topic.public_topic_timer.id)
-    end.first
+    end.find do |m|
+      Hash === m.data && m.data.key?(:reload_topic)
+    end
 
     topic.reload
     expect(topic.category).to eq(another_category)

GitHub sha: 0358931b

Similar to another message bus fail, warm up messages could throw this off.

1 Like