summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorGabriel Mazetto <gabriel@gitlab.com>2016-01-06 05:38:52 -0200
committerGabriel Mazetto <gabriel@gitlab.com>2016-01-08 16:26:04 -0200
commitec67e9be1d7486199b47e19c766202a8bfdefe93 (patch)
tree2499ddcd631bb0935b77d510a6a137ba4b2b1ac4 /spec/controllers
parentd6dc088affeee4568e771e1d7894e0bcdb955af8 (diff)
downloadgitlab-ce-ec67e9be1d7486199b47e19c766202a8bfdefe93.tar.gz
Repair ldap_blocked state when no ldap identity exist anymore
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin/identities_controller_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/controllers/admin/identities_controller_spec.rb b/spec/controllers/admin/identities_controller_spec.rb
new file mode 100644
index 00000000000..c131d22a30a
--- /dev/null
+++ b/spec/controllers/admin/identities_controller_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe Admin::IdentitiesController do
+ let(:admin) { create(:admin) }
+ before { sign_in(admin) }
+
+ describe 'UPDATE identity' do
+ let(:user) { create(:omniauth_user, provider: 'ldapmain', extern_uid: 'uid=myuser,ou=people,dc=example,dc=com') }
+
+ it 'repairs ldap blocks' do
+ expect_any_instance_of(RepairLdapBlockedUserService).to receive(:execute)
+
+ put :update, user_id: user.username, id: user.ldap_identity.id, identity: { provider: 'twitter' }
+ end
+ end
+
+ describe 'DELETE identity' do
+ let(:user) { create(:omniauth_user, provider: 'ldapmain', extern_uid: 'uid=myuser,ou=people,dc=example,dc=com') }
+
+ it 'repairs ldap blocks' do
+ expect_any_instance_of(RepairLdapBlockedUserService).to receive(:execute)
+
+ delete :destroy, user_id: user.username, id: user.ldap_identity.id
+ end
+ end
+end