2023-11-16 23:36:59 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 14:12:25 +09:00
|
|
|
RSpec.describe Admin::SuspensionWorker do
|
2023-11-16 23:36:59 +09:00
|
|
|
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
|