Improve spec coverage for collection of workers/
classes (#27874)
This commit is contained in:
parent
0a6ec048a8
commit
155fb84141
16 changed files with 460 additions and 8 deletions
28
spec/workers/admin/suspension_worker_spec.rb
Normal file
28
spec/workers/admin/suspension_worker_spec.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::SuspensionWorker do
|
||||
let(:worker) { described_class.new }
|
||||
let(:service) { instance_double(SuspendAccountService, call: true) }
|
||||
|
||||
describe '#perform' do
|
||||
before do
|
||||
allow(SuspendAccountService).to receive(:new).and_return(service)
|
||||
end
|
||||
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
it 'sends the account to the service' do
|
||||
worker.perform(account.id)
|
||||
|
||||
expect(service).to have_received(:call).with(account)
|
||||
end
|
||||
|
||||
it 'returns true for non-existent record' do
|
||||
result = worker.perform(123_123_123)
|
||||
|
||||
expect(result).to be(true)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue