diff options
author | Brett Walker <brett@digitalmoksha.com> | 2017-09-18 19:00:38 +0200 |
---|---|---|
committer | Brett Walker <brett@digitalmoksha.com> | 2017-09-23 15:26:04 +0200 |
commit | ed99c899a28134e8d9a1a8a8c4677a6ee65bbd2b (patch) | |
tree | 516de9ab6f14b7053a0a1b5d56a609efddb8ef28 /spec/models | |
parent | 442dbf6d4b1b50f9eccaeb5a62506c55daa0fc36 (diff) | |
download | gitlab-ce-ed99c899a28134e8d9a1a8a8c4677a6ee65bbd2b.tar.gz |
allow a verified secondary email to be use as the primary without
a reconfirmation
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/email_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/spec/models/email_spec.rb b/spec/models/email_spec.rb index 8fca9db37ca..8ae5ccd89ed 100644 --- a/spec/models/email_spec.rb +++ b/spec/models/email_spec.rb @@ -24,8 +24,6 @@ describe Email do email = user.emails.create(email: 'new@email.com') expect(user).to receive(:update_invalid_gpg_signatures) email.confirm - # email.save end end - end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index a230f72449a..c6df8028072 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -359,6 +359,19 @@ describe User do expect(external_user.projects_limit).to be 0 end end + + describe '#check_for_verified_email' do + let(:user) { create(:user) } + let(:secondary) { create(:email, :confirmed, email: 'secondary@example.com', user: user, ) } + + it 'allows a verfied secondary email to be used as the primary without needing reconfirmation' do + user.update_attributes!(email: secondary.email) + user.reload + expect(user.email).to eq secondary.email + expect(user.unconfirmed_email).to eq nil + expect(user.confirmed?).to be_truthy + end + end end describe 'after update hook' do |