Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 48e56051fc5..d73bc95a2f2 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -3125,6 +3125,19 @@ RSpec.describe User do
end
end
+ describe '#notification_email' do
+ let(:email) { 'gonzo@muppets.com' }
+
+ context 'when the column in the database is null' do
+ subject { create(:user, email: email, notification_email: nil) }
+
+ it 'defaults to the primary email' do
+ expect(subject.read_attribute(:notification_email)).to be nil
+ expect(subject.notification_email).to eq(email)
+ end
+ end
+ end
+
describe '.find_by_private_commit_email' do
context 'with email' do
let_it_be(:user) { create(:user) }