0
0
Fork 0

Worker specs coverage increase (#32541)

This commit is contained in:
Matt Jankowski 2024-10-23 03:50:20 -04:00 committed by GitHub
parent bd0c826a3d
commit d1b20ea8f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 186 additions and 15 deletions

View file

@ -0,0 +1,33 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ActivityPub::FollowersSynchronizationWorker do
let(:worker) { described_class.new }
let(:service) { instance_double(ActivityPub::SynchronizeFollowersService, call: true) }
describe '#perform' do
before { stub_service }
let(:account) { Fabricate(:account, domain: 'host.example') }
let(:url) { 'https://sync.url' }
it 'sends the status to the service' do
worker.perform(account.id, url)
expect(service).to have_received(:call).with(account, url)
end
it 'returns nil for non-existent record' do
result = worker.perform(123_123_123, url)
expect(result).to be(true)
end
end
def stub_service
allow(ActivityPub::SynchronizeFollowersService)
.to receive(:new)
.and_return(service)
end
end