about summary refs log tree commit diff
path: root/spec/workers/activitypub/move_distribution_worker_spec.rb
blob: 4df6b2f161ba8a8f8182cc6a52a3f8916988693d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

require 'rails_helper'

describe ActivityPub::MoveDistributionWorker do
  subject { described_class.new }

  let(:migration) { Fabricate(:account_migration) }
  let(:follower) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example.com') }
  let(:blocker) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example2.com') }

  describe '#perform' do
    before do
      follower.follow!(migration.account)
      blocker.block!(migration.account)
    end

    it 'delivers to followers and known blockers' do
      expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [
                                  [kind_of(String), migration.account.id, 'http://example.com'],
                                  [kind_of(String), migration.account.id, 'http://example2.com'],
                                ])
      subject.perform(migration.id)
    end
  end
end