diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-08 12:09:53 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-08 12:09:53 +0000 |
commit | 148b75b329294f6b6ae409bbf8d70590e63c6bc9 (patch) | |
tree | 30918a97e353067ff9c99e04fb7e296305d130b7 /spec/models/identity_spec.rb | |
parent | 707742e59ca57d1f2ea00d65fa35a7b9a5ded398 (diff) | |
download | gitlab-ce-148b75b329294f6b6ae409bbf8d70590e63c6bc9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/identity_spec.rb')
-rw-r--r-- | spec/models/identity_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/models/identity_spec.rb b/spec/models/identity_spec.rb index 696d33b7beb..c0efb2dff56 100644 --- a/spec/models/identity_spec.rb +++ b/spec/models/identity_spec.rb @@ -81,6 +81,36 @@ RSpec.describe Identity do end end + describe '.with_any_extern_uid' do + context 'provider with extern uid' do + let!(:test_entity) { create(:identity, provider: 'test_provider', extern_uid: 'test_uid') } + + it 'finds any extern uids associated with a provider' do + identity = described_class.with_any_extern_uid('test_provider').first + + expect(identity).to be + end + end + + context 'provider with nil extern uid' do + let!(:nil_entity) { create(:identity, provider: 'nil_entity_provider', extern_uid: nil) } + + it 'has no results when there are no extern uids' do + identity = described_class.with_any_extern_uid('nil_entity_provider').first + + expect(identity).to be_nil + end + end + + context 'no provider' do + it 'has no results when there is no associated provider' do + identity = described_class.with_any_extern_uid('nonexistent_provider').first + + expect(identity).to be_nil + end + end + end + context 'callbacks' do context 'before_save' do describe 'normalizes extern uid' do |