fix: destroy bulk service (#5921)

This commit is contained in:
Tejaswini Chile
2022-11-25 22:46:50 +05:30
committed by GitHub
parent b05d06a28a
commit fc9fc5a661
6 changed files with 65 additions and 51 deletions

View File

@@ -1,25 +0,0 @@
require 'rails_helper'
describe Agents::DestroyService do
let(:account) { create(:account) }
let(:user) { create(:user, account: account) }
let(:team1) { create(:team, account: account) }
let!(:inbox) { create(:inbox, account: account) }
before do
create(:team_member, team: team1, user: user)
create(:inbox_member, inbox: inbox, user: user)
create(:conversation, account: account, assignee: user, inbox: inbox)
end
describe '#perform' do
it 'remove inboxes, teams, and conversations when removed from account' do
described_class.new(account: account, user: user).perform
user.reload
expect(user.teams.length).to eq 0
expect(user.inboxes.length).to eq 0
expect(user.notification_settings.length).to eq 0
expect(user.assigned_conversations.where(account: account).length).to eq 0
end
end
end