summaryrefslogtreecommitdiff
path: root/spec/models/identity_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-10-31 10:52:44 +0100
committerDouwe Maan <douwe@selenight.nl>2017-10-31 17:13:50 +0100
commit8399de0c961be75d0cd90e59a7e89fabc11025b8 (patch)
treed4623bef5ee12e2ea9ca16f99f48c6eaae0a7992 /spec/models/identity_spec.rb
parentbb63ee682aac171db00bfd2c37395fa1f77a3cae (diff)
downloadgitlab-ce-8399de0c961be75d0cd90e59a7e89fabc11025b8.tar.gz
Normalize LDAP DN when looking up identity
Diffstat (limited to 'spec/models/identity_spec.rb')
-rw-r--r--spec/models/identity_spec.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/models/identity_spec.rb b/spec/models/identity_spec.rb
index 4ca6556d0f4..3ed048744de 100644
--- a/spec/models/identity_spec.rb
+++ b/spec/models/identity_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe Identity do
+describe Identity do
describe 'relations' do
it { is_expected.to belong_to(:user) }
end
@@ -22,4 +22,16 @@ RSpec.describe Identity do
expect(other_identity.ldap?).to be_falsey
end
end
+
+ describe '.with_extern_uid' do
+ context 'LDAP identity' do
+ let!(:ldap_identity) { create(:identity, provider: 'ldapmain', extern_uid: 'uid=john smith,ou=people,dc=example,dc=com') }
+
+ it 'finds the identity when the DN is formatted differently' do
+ identity = described_class.with_extern_uid('ldapmain', 'uid=John Smith, ou=People, dc=example, dc=com').first
+
+ expect(identity).to eq(ldap_identity)
+ end
+ end
+ end
end