diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-27 18:09:21 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-27 18:09:21 +0000 |
commit | e0fa0638a422c3e20d4423c9bb69d79afc9c7d3d (patch) | |
tree | 9abb3c0706576bbda895fe9539a55556930606e2 /spec/models/notification_recipient_spec.rb | |
parent | f8d15ca65390475e356b06dedc51e10ccd179f86 (diff) | |
download | gitlab-ce-e0fa0638a422c3e20d4423c9bb69d79afc9c7d3d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/notification_recipient_spec.rb')
-rw-r--r-- | spec/models/notification_recipient_spec.rb | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/spec/models/notification_recipient_spec.rb b/spec/models/notification_recipient_spec.rb index f6a36dbb3fc..05aeafaa4d4 100644 --- a/spec/models/notification_recipient_spec.rb +++ b/spec/models/notification_recipient_spec.rb @@ -176,8 +176,20 @@ describe NotificationRecipient do ) end - before do - notification_setting.update!(failed_pipeline: true) + it 'returns true' do + expect(recipient.suitable_notification_level?).to eq true + end + end + + context "when action is fixed_pipeline" do + let(:recipient) do + described_class.new( + user, + :watch, + custom_action: :fixed_pipeline, + target: target, + project: project + ) end it 'returns true' do @@ -185,7 +197,7 @@ describe NotificationRecipient do end end - context "when action is not failed_pipeline" do + context "when action is not fixed_pipeline or failed_pipeline" do let(:recipient) do described_class.new( user, @@ -196,10 +208,6 @@ describe NotificationRecipient do ) end - before do - notification_setting.update!(success_pipeline: true) - end - it 'returns false' do expect(recipient.suitable_notification_level?).to eq false end @@ -309,6 +317,26 @@ describe NotificationRecipient do expect(recipient.suitable_notification_level?).to eq false end end + + context 'when custom_action is fixed_pipeline and success_pipeline event is enabled' do + let(:recipient) do + described_class.new( + user, + :watch, + custom_action: :fixed_pipeline, + target: target, + project: project + ) + end + + before do + notification_setting.update!(success_pipeline: true) + end + + it 'returns true' do + expect(recipient.suitable_notification_level?).to eq true + end + end end end |