2024-02-21 16:58:19 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe CreateFeaturedTagService do
|
|
|
|
describe '#call' do
|
|
|
|
let(:tag) { 'test' }
|
|
|
|
|
|
|
|
context 'with a local account' do
|
|
|
|
let(:account) { Fabricate(:account, domain: nil) }
|
|
|
|
|
|
|
|
it 'creates a new featured tag and distributes' do
|
|
|
|
expect { subject.call(account, tag) }
|
|
|
|
.to change(FeaturedTag, :count).by(1)
|
|
|
|
expect(ActivityPub::AccountRawDistributionWorker)
|
|
|
|
.to have_enqueued_sidekiq_job(anything, account.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with a remote account' do
|
|
|
|
let(:account) { Fabricate(:account, domain: 'host.example') }
|
|
|
|
|
|
|
|
it 'creates a new featured tag and does not distributes' do
|
|
|
|
expect { subject.call(account, tag) }
|
|
|
|
.to change(FeaturedTag, :count).by(1)
|
|
|
|
expect(ActivityPub::AccountRawDistributionWorker)
|
2024-04-17 11:13:52 +00:00
|
|
|
.to_not have_enqueued_sidekiq_job(any_args)
|
2024-02-21 16:58:19 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|