expect{create(:data_privacy_task,deletable:create(:chat))}.toraise_error(ActiveRecord::RecordInvalid,'Validation failed: Deletable is not a User')
end
it'blocks the multiple deletion tasks for the same user'do
create(:data_privacy_task,deletable:user)
expect{create(:data_privacy_task,deletable:user)}.toraise_error(ActiveRecord::RecordInvalid,'Validation failed: Deletable has an existing DataPrivacyTask queued')
end
it'blocks deletion task for user id 1'do
expect{create(:data_privacy_task,deletable:User.find(1))}.toraise_error(ActiveRecord::RecordInvalid,'Validation failed: Deletable is undeletable system User with ID 1')
end
it'blocks deletion task for yourself'do
UserInfo.current_user_id=user.id
expect{create(:data_privacy_task,deletable:user)}.toraise_error(ActiveRecord::RecordInvalid,'Validation failed: Deletable is your current account')
end
it'blocks deletion task for last admin'do
expect{create(:data_privacy_task,deletable:admin)}.toraise_error(ActiveRecord::RecordInvalid,'Validation failed: Deletable is last account with admin permissions')