import_worker_spec.rb 566 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe ImportWorker do
  4. let(:worker) { described_class.new }
  5. let(:service) { instance_double(ImportService, call: true) }
  6. describe '#perform' do
  7. before do
  8. allow(ImportService).to receive(:new).and_return(service)
  9. end
  10. let(:import) { Fabricate(:import) }
  11. it 'sends the import to the service' do
  12. worker.perform(import.id)
  13. expect(service).to have_received(:call).with(import)
  14. expect { import.reload }.to raise_error(ActiveRecord::RecordNotFound)
  15. end
  16. end
  17. end