after_account_domain_block_worker_spec.rb 760 B

1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe AfterAccountDomainBlockWorker do
  4. let(:worker) { described_class.new }
  5. let(:service) { instance_double(AfterBlockDomainFromAccountService, call: true) }
  6. describe '#perform' do
  7. before do
  8. allow(AfterBlockDomainFromAccountService).to receive(:new).and_return(service)
  9. end
  10. let(:account) { Fabricate(:account) }
  11. let(:domain) { 'host.example' }
  12. it 'sends the account and domain to the service' do
  13. worker.perform(account.id, domain)
  14. expect(service).to have_received(:call).with(account, domain)
  15. end
  16. it 'returns true for non-existent record' do
  17. result = worker.perform(123_123_123, domain)
  18. expect(result).to be(true)
  19. end
  20. end
  21. end