diff options
author | Gabriel Mazetto <gabriel@gitlab.com> | 2016-01-06 05:38:52 -0200 |
---|---|---|
committer | Gabriel Mazetto <gabriel@gitlab.com> | 2016-01-08 16:26:04 -0200 |
commit | ec67e9be1d7486199b47e19c766202a8bfdefe93 (patch) | |
tree | 2499ddcd631bb0935b77d510a6a137ba4b2b1ac4 /spec/models | |
parent | d6dc088affeee4568e771e1d7894e0bcdb955af8 (diff) | |
download | gitlab-ce-ec67e9be1d7486199b47e19c766202a8bfdefe93.tar.gz |
Repair ldap_blocked state when no ldap identity exist anymore
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/identity_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/models/identity_spec.rb b/spec/models/identity_spec.rb new file mode 100644 index 00000000000..107bfc17782 --- /dev/null +++ b/spec/models/identity_spec.rb @@ -0,0 +1,38 @@ +# == Schema Information +# +# Table name: identities +# +# id :integer not null, primary key +# extern_uid :string(255) +# provider :string(255) +# user_id :integer +# created_at :datetime +# updated_at :datetime +# + +require 'spec_helper' + +RSpec.describe Identity, models: true do + + describe 'relations' do + it { is_expected.to belong_to(:user) } + end + + describe 'fields' do + it { is_expected.to respond_to(:provider) } + it { is_expected.to respond_to(:extern_uid) } + end + + describe '#is_ldap?' do + let(:ldap_identity) { create(:identity, provider: 'ldapmain') } + let(:other_identity) { create(:identity, provider: 'twitter') } + + it 'returns true if it is a ldap identity' do + expect(ldap_identity.is_ldap?).to be_truthy + end + + it 'returns false if it is not a ldap identity' do + expect(other_identity.is_ldap?).to be_falsey + end + end +end |