diff options
Diffstat (limited to 'spec/lib/gitlab/auth/ldap/config_spec.rb')
-rw-r--r-- | spec/lib/gitlab/auth/ldap/config_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/lib/gitlab/auth/ldap/config_spec.rb b/spec/lib/gitlab/auth/ldap/config_spec.rb index e4c87a54365..7a657cce597 100644 --- a/spec/lib/gitlab/auth/ldap/config_spec.rb +++ b/spec/lib/gitlab/auth/ldap/config_spec.rb @@ -5,6 +5,10 @@ require 'spec_helper' RSpec.describe Gitlab::Auth::Ldap::Config do include LdapHelpers + before do + stub_ldap_setting(enabled: true) + end + let(:config) { described_class.new('ldapmain') } def raw_cert @@ -68,12 +72,28 @@ AtlErSqafbECNDSwS5BX8yDpu5yRBJ4xegO/rNlmb8ICRYkuJapD1xXicFOsmfUK describe '.servers' do it 'returns empty array if no server information is available' do - allow(Gitlab.config).to receive(:ldap).and_return('enabled' => false) + stub_ldap_setting(servers: {}) expect(described_class.servers).to eq [] end end + describe '.available_providers' do + before do + stub_licensed_features(multiple_ldap_servers: false) + stub_ldap_setting( + 'servers' => { + 'main' => { 'provider_name' => 'ldapmain' }, + 'secondary' => { 'provider_name' => 'ldapsecondary' } + } + ) + end + + it 'returns one provider' do + expect(described_class.available_providers).to match_array(%w(ldapmain)) + end + end + describe '#initialize' do it 'requires a provider' do expect { described_class.new }.to raise_error ArgumentError |