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
path: root/spec
diff options
context:
space:
mode:
authorGabriel Mazetto <gabriel@gitlab.com>2016-04-05 22:33:37 +0300
committerGabriel Mazetto <gabriel@gitlab.com>2016-04-05 22:34:31 +0300
commit5ee6badade3c453c7090e9c1f1f4d636c5bb068e (patch)
tree2bdc59fa820512c44eff139c9eabd558c6a8bdd4 /spec
parent4a01b5e293ccb358d77ac1a25b92d14fd913a4d7 (diff)
Unblocks user when active_directory is disabled and it can be found
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/ldap/access_spec.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ldap/access_spec.rb b/spec/lib/gitlab/ldap/access_spec.rb
index 32a19bf344b..f5b66b8156f 100644
--- a/spec/lib/gitlab/ldap/access_spec.rb
+++ b/spec/lib/gitlab/ldap/access_spec.rb
@@ -33,7 +33,7 @@ describe Gitlab::LDAP::Access, lib: true do
it { is_expected.to be_falsey }
- it 'should block user in GitLab' do
+ it 'blocks user in GitLab' do
access.allowed?
expect(user).to be_blocked
expect(user).to be_ldap_blocked
@@ -78,6 +78,31 @@ describe Gitlab::LDAP::Access, lib: true do
end
it { is_expected.to be_truthy }
+
+ context 'when user cannot be found' do
+ before do
+ allow(Gitlab::LDAP::Person).to receive(:find_by_dn).and_return(nil)
+ end
+
+ it { is_expected.to be_falsey }
+
+ it 'blocks user in GitLab' do
+ access.allowed?
+ expect(user).to be_blocked
+ expect(user).to be_ldap_blocked
+ end
+ end
+
+ context 'when user was previously ldap_blocked' do
+ before do
+ user.ldap_block
+ end
+
+ it 'unblocks the user if it exists' do
+ access.allowed?
+ expect(user).not_to be_blocked
+ end
+ end
end
end
end