synchronize_featured_tags_collection_worker_spec.rb 802 B

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