2016-01-19 16:12:03 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe RepairLdapBlockedUserService, services: true do
|
|
|
|
let(:user) { create(:omniauth_user, provider: 'ldapmain', state: 'ldap_blocked') }
|
|
|
|
let(:identity) { user.ldap_identity }
|
|
|
|
subject(:service) { RepairLdapBlockedUserService.new(user) }
|
|
|
|
|
|
|
|
describe '#execute' do
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'changes to normal block after destroying last ldap identity' do
|
2016-01-19 16:12:03 +05:30
|
|
|
identity.destroy
|
|
|
|
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
|