0
0
Fork 0

Improve spec coverage for collection of workers/ classes (#27874)

This commit is contained in:
Matt Jankowski 2023-11-16 09:36:59 -05:00 committed by GitHub
parent 0a6ec048a8
commit 155fb84141
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 460 additions and 8 deletions

View file

@ -0,0 +1,28 @@
# frozen_string_literal: true
require 'rails_helper'
describe RemovalWorker do
let(:worker) { described_class.new }
let(:service) { instance_double(RemoveStatusService, call: true) }
describe '#perform' do
before do
allow(RemoveStatusService).to receive(:new).and_return(service)
end
let(:status) { Fabricate(:status) }
it 'sends the status to the service' do
worker.perform(status.id)
expect(service).to have_received(:call).with(status)
end
it 'returns true for non-existent record' do
result = worker.perform(123_123_123)
expect(result).to be(true)
end
end
end