fix: Remove teams on account user destroy (#1766)

This commit is contained in:
Pranav Raj S
2021-02-15 13:32:52 +05:30
committed by GitHub
parent 27cf5ecdce
commit 64d7dc5335
4 changed files with 73 additions and 4 deletions

View File

@@ -4,6 +4,12 @@ require 'rails_helper'
RSpec.describe User do
let!(:account_user) { create(:account_user) }
let(:agent_destroy_service) { double }
before do
allow(Agents::DestroyService).to receive(:new).and_return(agent_destroy_service)
allow(agent_destroy_service).to receive(:perform).and_return(agent_destroy_service)
end
describe 'notification_settings' do
it 'gets created with the right default settings' do
@@ -13,4 +19,15 @@ RSpec.describe User do
expect(account_user.user.notification_settings.first.email_conversation_assignment?).to eq(true)
end
end
describe 'destroy call agent::destroy service' do
it 'gets created with the right default settings' do
user = account_user.user
account = account_user.account
account_user.destroy!
expect(Agents::DestroyService).to have_received(:new).with({
user: user, account: account
})
end
end
end