2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-01-19 16:12:03 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
RSpec.describe Users::RepairLdapBlockedService, feature_category: :system_access do
|
2016-01-19 16:12:03 +05:30
|
|
|
let(:user) { create(:omniauth_user, provider: 'ldapmain', state: 'ldap_blocked') }
|
|
|
|
let(:identity) { user.ldap_identity }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
subject(:service) { described_class.new(user) }
|
2016-01-19 16:12:03 +05:30
|
|
|
|
|
|
|
describe '#execute' do
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'changes to normal block after destroying last ldap identity' do
|
2021-01-29 00:20:46 +05:30
|
|
|
identity.destroy!
|
2016-01-19 16:12:03 +05:30
|
|
|
service.execute
|
|
|
|
|
|
|
|
expect(user.reload).not_to be_ldap_blocked
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'changes to normal block after changing last ldap identity to another provider' do
|
2016-01-19 16:12:03 +05:30
|
|
|
identity.update_attribute(:provider, 'twitter')
|
|
|
|
service.execute
|
|
|
|
|
|
|
|
expect(user.reload).not_to be_ldap_blocked
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|