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:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2018-04-22 21:08:08 +0300
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2018-04-23 01:50:56 +0300
commitf8d54913bb6f846d1204704d3a6e457956461b35 (patch)
tree7541e607f0e77638411448cf42482ee3ba778cf7 /spec/lib/gitlab/auth
parentf10c999bca2b5b37b068ff3680a6e35a6707828d (diff)
Show error on failed OAuth account link
Diffstat (limited to 'spec/lib/gitlab/auth')
-rw-r--r--spec/lib/gitlab/auth/o_auth/identity_linker_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/auth/o_auth/identity_linker_spec.rb b/spec/lib/gitlab/auth/o_auth/identity_linker_spec.rb
index dc6aa5de53a..8d1b0a3cd4b 100644
--- a/spec/lib/gitlab/auth/o_auth/identity_linker_spec.rb
+++ b/spec/lib/gitlab/auth/o_auth/identity_linker_spec.rb
@@ -14,6 +14,26 @@ describe Gitlab::Auth::OAuth::IdentityLinker do
it "doesn't create new identity" do
expect { subject.create_or_update }.not_to change { Identity.count }
end
+
+ it "#created? returns false" do
+ subject.create_or_update
+
+ expect(subject).not_to be_created
+ end
+ end
+
+ context 'identity already linked to different user' do
+ let!(:identity) { create(:identity, provider: provider, extern_uid: uid) }
+
+ it "#created? returns false" do
+ subject.create_or_update
+
+ expect(subject).not_to be_created
+ end
+
+ it 'exposes error message' do
+ expect(subject.error_message).to eq 'Extern uid has already been taken'
+ end
end
context 'identity needs to be created' do