summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoregrieff <egrieff@gitlab.com>2019-06-10 13:42:37 +0100
committeregrieff <egrieff@gitlab.com>2019-06-10 13:42:37 +0100
commitec4298883d0597e18dd1e066aec9bc42e506d6a8 (patch)
treea4124376b8cbe8e3b4da62eadc9a8a8bc803b9ea
parente748cc77c2503dd771cc1176a38f9532ad458c3c (diff)
downloadgitlab-ce-ec4298883d0597e18dd1e066aec9bc42e506d6a8.tar.gz
Amend tests for suitable notification levels
-rw-r--r--spec/models/notification_recipient_spec.rb56
1 files changed, 7 insertions, 49 deletions
diff --git a/spec/models/notification_recipient_spec.rb b/spec/models/notification_recipient_spec.rb
index 9b4917d9a94..32d2e39df1b 100644
--- a/spec/models/notification_recipient_spec.rb
+++ b/spec/models/notification_recipient_spec.rb
@@ -127,7 +127,7 @@ describe NotificationRecipient do
let(:recipient) do
described_class.new(
user,
- :participating,
+ :watch,
custom_action: :success_pipeline,
target: target,
project: project
@@ -148,48 +148,6 @@ describe NotificationRecipient do
expect(recipient.suitable_notification_level?).to eq true
end
end
-
- context 'with excluded participating events' do
- let(:recipient) do
- described_class.new(
- user,
- :mention,
- custom_action: :success_pipeline,
- target: target,
- project: project
- )
- end
-
- it 'returns false' do
- expect(recipient.suitable_notification_level?).to eq false
- end
- end
- end
-
- context 'when type is watch' do
- context 'without excluded participating events' do
- let(:recipient) { described_class.new(user, :watch, target: target, project: project) }
-
- it 'returns true' do
- expect(recipient.suitable_notification_level?).to eq true
- end
- end
-
- context 'with excluded participating events' do
- let(:recipient) do
- described_class.new(
- user,
- :watch,
- custom_action: :success_pipeline,
- target: target,
- project: project
- )
- end
-
- it 'returns false' do
- expect(recipient.suitable_notification_level?).to eq false
- end
- end
end
end
@@ -205,14 +163,14 @@ describe NotificationRecipient do
described_class.new(
user,
:participating,
- custom_action: :success_pipeline,
+ custom_action: :new_note,
target: target,
project: project
)
end
before do
- notification_setting.update!(success_pipeline: true)
+ notification_setting.update!(new_note: true)
end
it 'returns true' do
@@ -236,14 +194,14 @@ describe NotificationRecipient do
described_class.new(
user,
:mention,
- custom_action: :issue_due,
+ custom_action: :new_issue,
target: target,
project: project
)
end
before do
- notification_setting.update!(issue_due: true)
+ notification_setting.update!(new_issue: true)
end
it 'returns true' do
@@ -267,14 +225,14 @@ describe NotificationRecipient do
described_class.new(
user,
:watch,
- custom_action: :issue_due,
+ custom_action: :failed_pipeline,
target: target,
project: project
)
end
before do
- notification_setting.update!(issue_due: true)
+ notification_setting.update!(failed_pipeline: true)
end
it 'returns true' do