repair_ldap_blocked_user_service_spec.rb 675 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe RepairLdapBlockedUserService do
4 5
  let(:user) { create(:omniauth_user, provider: 'ldapmain', state: 'ldap_blocked') }
  let(:identity) { user.ldap_identity }
6
  subject(:service) { described_class.new(user) }
7 8

  describe '#execute' do
9
    it 'changes to normal block after destroying last ldap identity' do
10 11 12 13 14 15
      identity.destroy
      service.execute

      expect(user.reload).not_to be_ldap_blocked
    end

16
    it 'changes to normal block after changing last ldap identity to another provider' do
17 18 19 20 21 22 23
      identity.update_attribute(:provider, 'twitter')
      service.execute

      expect(user.reload).not_to be_ldap_blocked
    end
  end
end