correct erratic spec

approved
heisentest
#1

correct erratic spec

diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 8bb2f64..645b263 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1404,7 +1404,7 @@ describe User do
     let(:user) { Fabricate(:user) }
 
     it 'should publish the right message' do
-      message = MessageBus.track_publish { user.logged_out }.first
+      message = MessageBus.track_publish { user.logged_out }.find { |m| m.channel == '/logout'}
 
       expect(message.channel).to eq('/logout')
       expect(message.data).to eq(user.id)

GitHub sha: f60a1b02

#2

Another nice one, missing filter so any noise can break the test, ideally noise should be impossible so this is only acceptable if the noise is “normal” eg. stuff that warms up on first run and causes more messages in a specific test

1 Like
Follow Up #3
#5

@ZogStriP we use track_publish these days which is way cleaner … I think @tgxworld moved most of the internal including this spec. I think the current behavior here is good.

1 Like
#6

Sorry I fat fingered this and clicked follow up instead of approve :frowning:

1 Like
Approved #7