summaryrefslogtreecommitdiff
path: root/spec/models/notification_setting_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-27 21:08:05 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-27 21:08:05 +0000
commit47579e24f3f9f29d5b8093f54e6958fefd7f2057 (patch)
treee8dedf16ceaa2143ce4e81906527a4670cb9916a /spec/models/notification_setting_spec.rb
parent88ccc935c04ff0e015be60bac02853770b79d28d (diff)
downloadgitlab-ce-47579e24f3f9f29d5b8093f54e6958fefd7f2057.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/notification_setting_spec.rb')
-rw-r--r--spec/models/notification_setting_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/models/notification_setting_spec.rb b/spec/models/notification_setting_spec.rb
index 9ab9ae494ec..67738eaec20 100644
--- a/spec/models/notification_setting_spec.rb
+++ b/spec/models/notification_setting_spec.rb
@@ -48,6 +48,33 @@ RSpec.describe NotificationSetting do
expect(notification_setting.reopen_merge_request).to eq(false)
end
end
+
+ context 'notification_email' do
+ let_it_be(:user) { create(:user) }
+ subject { described_class.new(source_id: 1, source_type: 'Project', user_id: user.id) }
+
+ it 'allows to change email to verified one' do
+ email = create(:email, :confirmed, user: user)
+
+ subject.update(notification_email: email.email)
+
+ expect(subject).to be_valid
+ end
+
+ it 'does not allow to change email to not verified one' do
+ email = create(:email, user: user)
+
+ subject.update(notification_email: email.email)
+
+ expect(subject).to be_invalid
+ end
+
+ it 'allows to change email to empty one' do
+ subject.update(notification_email: '')
+
+ expect(subject).to be_valid
+ end
+ end
end
describe '#for_projects' do