DEV: Add test (#8960)

DEV: Add test (#8960)

Follow-up to 3ad07aacfaab57aa458b43c3896ccb805bb26722.

diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb
index eabbbc68b5..0139780c19 100644
--- a/spec/models/notification_spec.rb
+++ b/spec/models/notification_spec.rb
@@ -122,15 +122,29 @@ describe Notification do
   end
 
   describe 'message bus' do
+    fab!(:user) { Fabricate(:user) }
 
     it 'updates the notification count on create' do
       Notification.any_instance.expects(:refresh_notification_count).returns(nil)
       Fabricate(:notification)
     end
 
+    it 'works' do
+      messages = MessageBus.track_publish do
+        user.notifications.create!(notification_type: Notification.types[:mentioned], data: '{}')
+        user.notifications.create!(notification_type: Notification.types[:mentioned], data: '{}')
+      end
+
+      expect(messages.size).to eq(2)
+      expect(messages[0].channel).to eq("/notification/#{user.id}")
+      expect(messages[0].data[:unread_notifications]).to eq(1)
+      expect(messages[1].channel).to eq("/notification/#{user.id}")
+      expect(messages[1].data[:unread_notifications]).to eq(2)
+    end
+
     it 'works for partial model instances' do
       NotificationEmailer.disable
-      partial_user = User.select(:id).find_by(id: Fabricate(:user).id)
+      partial_user = User.select(:id).find_by(id: user.id)
       partial_user.notifications.create!(notification_type: Notification.types[:mentioned], data: '{}')
     end

GitHub sha: 9aeb9f0c

This commit appears in #8960 which was approved by @eviltrout. It was merged by @udan11.