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/email_spec.rb')
-rw-r--r--spec/models/email_spec.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/models/email_spec.rb b/spec/models/email_spec.rb
index 2b09ee5c190..59299a507e4 100644
--- a/spec/models/email_spec.rb
+++ b/spec/models/email_spec.rb
@@ -13,6 +13,15 @@ RSpec.describe Email do
it_behaves_like 'an object with RFC3696 compliant email-formatted attributes', :email do
subject { build(:email) }
end
+
+ context 'when the email conflicts with the primary email of a different user' do
+ let(:user) { create(:user) }
+ let(:email) { build(:email, email: user.email) }
+
+ it 'is invalid' do
+ expect(email).to be_invalid
+ end
+ end
end
it 'normalize email value' do
@@ -33,7 +42,7 @@ RSpec.describe Email do
end
describe 'scopes' do
- let(:user) { create(:user) }
+ let(:user) { create(:user, :unconfirmed) }
it 'scopes confirmed emails' do
create(:email, :confirmed, user: user)