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

identities_controller_spec.rb « admin « controllers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 256aafe09f8b7462025c385aba9de8e5db908bb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

require 'spec_helper'

describe Admin::IdentitiesController do
  let(:admin) { create(:admin) }

  before do
    sign_in(admin)
  end

  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_next_instance_of(RepairLdapBlockedUserService) do |instance|
        expect(instance).to receive(:execute)
      end

      put :update, params: { 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_next_instance_of(RepairLdapBlockedUserService) do |instance|
        expect(instance).to receive(:execute)
      end

      delete :destroy, params: { user_id: user.username, id: user.ldap_identity.id }
    end
  end
end