summaryrefslogtreecommitdiff
path: root/spec/models/identity_spec.rb
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axilleas@axilleas.me>2016-01-18 08:17:48 +0100
committerAchilleas Pipinellis <axilleas@axilleas.me>2016-01-18 08:17:48 +0100
commit3ecb3024a40882896632ff78789713a4552a19ab (patch)
treee2a250e2434edde20f3e64431fc39d77a4d45977 /spec/models/identity_spec.rb
parent07f5a6f107529a932ca7d657a8473cba1afcba05 (diff)
parent835f1961e65fe9b4f943b17747b1518c555e8bfd (diff)
downloadgitlab-ce-docs_refactor.tar.gz
Merge branch 'master' into docs_refactordocs_refactor
Diffstat (limited to 'spec/models/identity_spec.rb')
-rw-r--r--spec/models/identity_spec.rb38
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..5afe042e154
--- /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.ldap?).to be_truthy
+ end
+
+ it 'returns false if it is not a ldap identity' do
+ expect(other_identity.ldap?).to be_falsey
+ end
+ end
+end