domain_clear_media_worker_spec.rb 754 B

1234567891011121314151617181920212223242526
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe DomainClearMediaWorker do
  4. subject { described_class.new }
  5. describe 'perform' do
  6. let(:domain_block) { Fabricate(:domain_block, severity: :silence, reject_media: true) }
  7. it 'calls domain clear media service for relevant domain block' do
  8. service = instance_double(ClearDomainMediaService, call: nil)
  9. allow(ClearDomainMediaService).to receive(:new).and_return(service)
  10. result = subject.perform(domain_block.id)
  11. expect(result).to be_nil
  12. expect(service).to have_received(:call).with(domain_block)
  13. end
  14. it 'returns true for non-existent domain block' do
  15. result = subject.perform('aaa')
  16. expect(result).to be(true)
  17. end
  18. end
  19. end