regeneration_worker_spec.rb 636 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe RegenerationWorker do
  4. subject { described_class.new }
  5. describe 'perform' do
  6. let(:account) { Fabricate(:account) }
  7. it 'calls the precompute feed service for the account' do
  8. service = double(call: nil)
  9. allow(PrecomputeFeedService).to receive(:new).and_return(service)
  10. result = subject.perform(account.id)
  11. expect(result).to be_nil
  12. expect(service).to have_received(:call).with(account)
  13. end
  14. it 'fails when account does not exist' do
  15. result = subject.perform('aaa')
  16. expect(result).to eq(true)
  17. end
  18. end
  19. end