summaryrefslogtreecommitdiff
path: root/spec/models/notification_recipient_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/notification_recipient_spec.rb')
-rw-r--r--spec/models/notification_recipient_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/models/notification_recipient_spec.rb b/spec/models/notification_recipient_spec.rb
index 8429f577dc6..4debda0621c 100644
--- a/spec/models/notification_recipient_spec.rb
+++ b/spec/models/notification_recipient_spec.rb
@@ -337,6 +337,39 @@ RSpec.describe NotificationRecipient do
expect(recipient.suitable_notification_level?).to eq true
end
end
+
+ context 'with merge_when_pipeline_succeeds' do
+ let(:notification_setting) { user.notification_settings_for(project) }
+ let(:recipient) do
+ described_class.new(
+ user,
+ :watch,
+ custom_action: :merge_when_pipeline_succeeds,
+ target: target,
+ project: project
+ )
+ end
+
+ context 'custom event enabled' do
+ before do
+ notification_setting.update!(merge_when_pipeline_succeeds: true)
+ end
+
+ it 'returns true' do
+ expect(recipient.suitable_notification_level?).to eq true
+ end
+ end
+
+ context 'custom event disabled' do
+ before do
+ notification_setting.update!(merge_when_pipeline_succeeds: false)
+ end
+
+ it 'returns false' do
+ expect(recipient.suitable_notification_level?).to eq false
+ end
+ end
+ end
end
end