2019-04-11 12:17:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-01-06 07:38:52 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 15:08:50 +00:00
|
|
|
RSpec.describe Users::RepairLdapBlockedService do
|
2016-01-06 07:38:52 +00:00
|
|
|
let(:user) { create(:omniauth_user, provider: 'ldapmain', state: 'ldap_blocked') }
|
|
|
|
let(:identity) { user.ldap_identity }
|
2019-12-12 12:07:33 +00:00
|
|
|
|
2017-07-25 17:09:00 +00:00
|
|
|
subject(:service) { described_class.new(user) }
|
2016-01-06 07:38:52 +00:00
|
|
|
|
|
|
|
describe '#execute' do
|
2016-08-01 15:00:44 +00:00
|
|
|
it 'changes to normal block after destroying last ldap identity' do
|
2016-01-06 07:38:52 +00:00
|
|
|
identity.destroy
|
|
|
|
service.execute
|
|
|
|
|
|
|
|
expect(user.reload).not_to be_ldap_blocked
|
|
|
|
end
|
|
|
|
|
2016-08-01 15:00:44 +00:00
|
|
|
it 'changes to normal block after changing last ldap identity to another provider' do
|
2016-01-06 07:38:52 +00:00
|
|
|
identity.update_attribute(:provider, 'twitter')
|
|
|
|
service.execute
|
|
|
|
|
|
|
|
expect(user.reload).not_to be_ldap_blocked
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|