DEV: Add test when user is suspended (#219)

DEV: Add test when user is suspended (#219)

diff --git a/spec/jobs/regular/assign_notification_spec.rb b/spec/jobs/regular/assign_notification_spec.rb
index 00a5b12..21cd370 100644
--- a/spec/jobs/regular/assign_notification_spec.rb
+++ b/spec/jobs/regular/assign_notification_spec.rb
@@ -64,12 +64,14 @@ RSpec.describe Jobs::AssignNotification do
 
     context 'Group' do
       fab!(:user3) { Fabricate(:user) }
+      fab!(:user4) { Fabricate(:user, suspended_till: 1.year.from_now) }
       fab!(:group) { Fabricate(:group) }
       let(:assignment) { Assignment.create!(topic: topic, assigned_by_user: user1, assigned_to: group) }
 
       before do
         group.add(user2)
         group.add(user3)
+        group.add(user4)
       end
 
       it 'sends notification alert to all group members' do
@@ -84,33 +86,29 @@ RSpec.describe Jobs::AssignNotification do
         end
         expect(messages.length).to eq(1)
         expect(messages.first.data[:excerpt]).to eq("assigned you the topic '#{topic.title}'")
+
+        messages = MessageBus.track_publish("/notification-alert/#{user4.id}") do
+          described_class.new.execute({ topic_id: topic.id, assigned_to_id: group.id, assigned_to_type: 'Group', assigned_by_id: user1.id, silent: false })
+        end
+        expect(messages.length).to eq(0)
       end
 
       it 'sends a high priority notification to all group members' do
-        Notification.expects(:create!).with(
-          notification_type: Notification.types[:custom],
-          user_id: user2.id,
-          topic_id: topic.id,
-          post_number: 1,
-          high_priority: true,
-          data: {
-            message: 'discourse_assign.assign_group_notification',
-            display_username: group.name,
-            topic_title: topic.title
-          }.to_json
-        )
-        Notification.expects(:create!).with(
-          notification_type: Notification.types[:custom],
-          user_id: user3.id,
-          topic_id: topic.id,
-          post_number: 1,
-          high_priority: true,
-          data: {
-            message: 'discourse_assign.assign_group_notification',
-            display_username: group.name,
-            topic_title: topic.title
-          }.to_json
-        )
+        [user2, user3, user4].each do |user|
+          Notification.expects(:create!).with(
+            notification_type: Notification.types[:custom],
+            user_id: user.id,
+            topic_id: topic.id,
+            post_number: 1,
+            high_priority: true,
+            data: {
+              message: 'discourse_assign.assign_group_notification',
+              display_username: group.name,
+              topic_title: topic.title
+            }.to_json
+          )
+        end
+
         described_class.new.execute({ topic_id: topic.id, assigned_to_id: group.id, assigned_to_type: 'Group', assigned_by_id: user1.id, silent: false })
       end
     end

GitHub sha: 247c74ecfd60667c698986388c3651c284097cff

This commit appears in #219 which was approved by CvX. It was merged by nbianca.