You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
664 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe DomainBlockWorker do
  4. subject { described_class.new }
  5. describe 'perform' do
  6. let(:domain_block) { Fabricate(:domain_block) }
  7. it 'returns true for non-existent domain block' do
  8. service = double(call: nil)
  9. allow(BlockDomainService).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 'calls domain block service for relevant domain block' do
  15. result = subject.perform('aaa')
  16. expect(result).to eq(true)
  17. end
  18. end
  19. end