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:
authorDouwe Maan <douwe@gitlab.com>2015-05-12 12:21:56 +0300
committerDouwe Maan <douwe@gitlab.com>2015-05-12 12:26:43 +0300
commit125cb9b866b66a4ae21a3fec8ae5ad6e1b3ae4ec (patch)
treeca2371ba805ccaea0410a302b831ef42be72716a /spec/lib/gitlab/ldap
parentf84e78f3d750776793371940803b7ff781050f09 (diff)
Don't accidentally unblock auto created users from Active Directory.
Diffstat (limited to 'spec/lib/gitlab/ldap')
-rw-r--r--spec/lib/gitlab/ldap/access_spec.rb27
1 files changed, 23 insertions, 4 deletions
diff --git a/spec/lib/gitlab/ldap/access_spec.rb b/spec/lib/gitlab/ldap/access_spec.rb
index 707a0521ab3..2189e313d6a 100644
--- a/spec/lib/gitlab/ldap/access_spec.rb
+++ b/spec/lib/gitlab/ldap/access_spec.rb
@@ -16,7 +16,7 @@ describe Gitlab::LDAP::Access do
context 'when the user is found' do
before { Gitlab::LDAP::Person.stub(find_by_dn: :ldap_user) }
- context 'and the user is diabled via active directory' do
+ context 'and the user is disabled via active directory' do
before { Gitlab::LDAP::Person.stub(disabled_via_active_directory?: true) }
it { is_expected.to be_falsey }
@@ -36,9 +36,28 @@ describe Gitlab::LDAP::Access do
it { is_expected.to be_truthy }
- it "should unblock user in GitLab" do
- access.allowed?
- user.should_not be_blocked
+ context 'when auto-created users are blocked' do
+
+ before do
+ Gitlab::LDAP::Config.any_instance.stub(block_auto_created_users: true)
+ end
+
+ it "does not unblock user in GitLab" do
+ access.allowed?
+ user.should be_blocked
+ end
+ end
+
+ context "when auto-created users are not blocked" do
+
+ before do
+ Gitlab::LDAP::Config.any_instance.stub(block_auto_created_users: false)
+ end
+
+ it "should unblock user in GitLab" do
+ access.allowed?
+ user.should_not be_blocked
+ end
end
end