fix specs
This commit is contained in:
parent
b56b96d438
commit
f9a730ebb4
|
|
@ -2,16 +2,19 @@ require "spec_helper"
|
|||
|
||||
describe OauthHelper do
|
||||
describe "additional_providers" do
|
||||
it 'returns appropriate values' do
|
||||
[
|
||||
[[:twitter, :github], [:twitter, :github]],
|
||||
[[:ldap_main], []],
|
||||
[[:twitter, :ldap_main], [:twitter]],
|
||||
[[], []],
|
||||
].each do |couple|
|
||||
allow(helper).to receive(:enabled_oauth_providers) { couple.first }
|
||||
additional_providers.should include(*couple.last)
|
||||
end
|
||||
it 'returns all enabled providers' do
|
||||
allow(helper).to receive(:enabled_oauth_providers) { [:twitter, :github] }
|
||||
helper.additional_providers.should include(*[:twitter, :github])
|
||||
end
|
||||
|
||||
it 'does not return ldap provider' do
|
||||
allow(helper).to receive(:enabled_oauth_providers) { [:twitter, :ldapmain] }
|
||||
helper.additional_providers.should include(:twitter)
|
||||
end
|
||||
|
||||
it 'returns empty array' do
|
||||
allow(helper).to receive(:enabled_oauth_providers) { [] }
|
||||
helper.additional_providers.should == []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe Gitlab::LDAP::Access do
|
||||
let(:access) { Gitlab::LDAP::Access.new user }
|
||||
let(:user) { create(:user, :ldap) }
|
||||
let(:user) { create(:omniauth_user) }
|
||||
|
||||
describe :allowed? do
|
||||
subject { access.allowed? }
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe Gitlab::LDAP::Authentication do
|
||||
let(:klass) { Gitlab::LDAP::Authentication }
|
||||
let(:user) { create(:user, :ldap, extern_uid: dn) }
|
||||
let(:user) { create(:omniauth_user, extern_uid: dn) }
|
||||
let(:dn) { 'uid=john,ou=people,dc=example,dc=com' }
|
||||
let(:login) { 'john' }
|
||||
let(:password) { 'password' }
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ describe Gitlab::LDAP::User do
|
|||
end
|
||||
|
||||
it "connects to existing non-ldap user if the email matches" do
|
||||
existing_user = create(:omniauth_user, email: 'john@example.com')
|
||||
existing_user = create(:omniauth_user, email: 'john@example.com', provider: "twitter")
|
||||
expect{ gl_user.save }.to_not change{ User.count }
|
||||
|
||||
existing_user.reload
|
||||
|
|
|
|||
Loading…
Reference in New Issue