diff options
author | Valery Sizov <vsv2711@gmail.com> | 2014-11-27 14:34:39 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2014-12-04 14:03:55 +0300 |
commit | 3a5ed5260b24051939575d1934ce9b8392cac09f (patch) | |
tree | 04d361e52d16234f00e5cdd27b5ebfef9a503579 /spec/models | |
parent | 1a80d13a3990937580c97e2b0ba8fb98f69bc055 (diff) |
Supporting for multiple omniauth provider for the same user
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/user_spec.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 6d865cfc691..8be7f733a5b 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -62,6 +62,7 @@ describe User do it { should have_many(:assigned_issues).dependent(:destroy) } it { should have_many(:merge_requests).dependent(:destroy) } it { should have_many(:assigned_merge_requests).dependent(:destroy) } + it { should have_many(:identities).dependent(:destroy) } end describe "Mass assignment" do @@ -361,24 +362,29 @@ describe User do end describe :ldap_user? do - let(:user) { build(:user, :ldap) } - it "is true if provider name starts with ldap" do - user.provider = 'ldapmain' + user = create(:omniauth_user, provider: 'ldapmain') expect( user.ldap_user? ).to be_true end it "is false for other providers" do - user.provider = 'other-provider' + user = create(:omniauth_user, provider: 'other-provider') expect( user.ldap_user? ).to be_false end it "is false if no extern_uid is provided" do - user.extern_uid = nil + user = create(:omniauth_user, extern_uid: nil) expect( user.ldap_user? ).to be_false end end + describe :ldap_identity do + it "returns ldap identity" do + user = create :omniauth_user + user.ldap_identity.provider.should_not be_empty + end + end + describe '#full_website_url' do let(:user) { create(:user) } |