Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Willem van der Meer <mail@jewilmeer.nl>2014-10-13 19:24:05 +0400
committerJan-Willem van der Meer <mail@jewilmeer.nl>2014-10-13 19:24:05 +0400
commit01b791237cf6a1b7deaee3da3df6541e0b5107d1 (patch)
treeab0ce5fae35c83d3f5e70f001616352df4eee33a /spec/lib/gitlab/ldap
parent6c0994a3b3197fe177ac804b0cd25096ff478263 (diff)
Refactor lib files for multiple LDAP groups
Diffstat (limited to 'spec/lib/gitlab/ldap')
-rw-r--r--spec/lib/gitlab/ldap/access_spec.rb26
1 files changed, 10 insertions, 16 deletions
diff --git a/spec/lib/gitlab/ldap/access_spec.rb b/spec/lib/gitlab/ldap/access_spec.rb
index d50f605e050..f4d5a927396 100644
--- a/spec/lib/gitlab/ldap/access_spec.rb
+++ b/spec/lib/gitlab/ldap/access_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'
describe Gitlab::LDAP::Access do
- let(:access) { Gitlab::LDAP::Access.new }
- let(:user) { create(:user) }
+ let(:access) { Gitlab::LDAP::Access.new user }
+ let(:user) { create(:user, :ldap) }
describe :allowed? do
- subject { access.allowed?(user) }
+ subject { access.allowed? }
context 'when the user cannot be found' do
before { Gitlab::LDAP::Person.stub(find_by_dn: nil) }
@@ -28,20 +28,14 @@ describe Gitlab::LDAP::Access do
it { should be_true }
end
- context 'and has no disabled flag in active diretory' do
- before {
- Gitlab::LDAP::Person.stub(disabled_via_active_directory?: false)
- Gitlab.config.ldap['enabled'] = true
- Gitlab.config.ldap['active_directory'] = false
- }
-
- after {
- Gitlab.config.ldap['enabled'] = false
- Gitlab.config.ldap['active_directory'] = true
- }
+ context 'without ActiveDirectory enabled' do
+ before do
+ Gitlab::LDAP::Config.stub(enabled?: true)
+ Gitlab::LDAP::Config.any_instance.stub(active_directory: false)
+ end
- it { should be_false }
+ it { should be_true }
end
end
end
-end
+end \ No newline at end of file