- Add a job to remove stale contacts and contact_inboxes across all accounts Stale anonymous contact is defined as - have no identification (email, phone_number, and identifier are NULL) - have no conversations - are older than 30 days --------- Co-authored-by: Pranav <pranav@chatwoot.com> Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
21 lines
624 B
Ruby
21 lines
624 B
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe Internal::RemoveStaleContactsJob do
|
|
subject(:job) { described_class.perform_later(account) }
|
|
|
|
let(:account) { create(:account) }
|
|
|
|
it 'enqueues the job' do
|
|
expect { job }.to have_enqueued_job(described_class)
|
|
.with(account)
|
|
.on_queue('low')
|
|
end
|
|
|
|
it 'calls the RemoveStaleContactsService' do
|
|
service = instance_double(Internal::RemoveStaleContactsService)
|
|
expect(Internal::RemoveStaleContactsService).to receive(:new).with(account: account).and_return(service)
|
|
expect(service).to receive(:perform)
|
|
described_class.perform_now(account)
|
|
end
|
|
end
|