Merge remote-tracking branch 'parent/main' into upstream-20240112

This commit is contained in:
KMY 2024-01-12 14:48:17 +09:00
commit e65fb9fb51
333 changed files with 2661 additions and 1461 deletions

View file

@ -225,7 +225,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
end
end
context 'with statuses referencing other statuses' do
context 'with statuses referencing other statuses', :sidekiq_inline do
before do
stub_const 'ActivityPub::FetchRemoteStatusService::DISCOVERIES_PER_REQUEST', 5
end

View file

@ -447,7 +447,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
end
end
it 'creates accounts without exceeding rate limit' do
it 'creates accounts without exceeding rate limit', :sidekiq_inline do
expect { subject.call('user1', 'foo.test', payload) }
.to create_some_remote_accounts
.and create_fewer_than_rate_limit_accounts

View file

@ -41,7 +41,7 @@ RSpec.describe AuthorizeFollowService, type: :service do
expect(bob.following?(sender)).to be true
end
it 'sends an accept activity' do
it 'sends an accept activity', :sidekiq_inline do
expect(a_request(:post, bob.inbox_url)).to have_been_made.once
end
end

View file

@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe BatchedRemoveStatusService, type: :service do
RSpec.describe BatchedRemoveStatusService, :sidekiq_inline, type: :service do
subject { described_class.new }
let!(:alice) { Fabricate(:account) }

View file

@ -90,7 +90,7 @@ RSpec.describe BlockDomainService, type: :service do
expect(already_banned_account.reload.silenced_at).to_not eq DomainBlock.find_by(domain: 'evil.org').created_at
end
it 'leaves the domains status and attachments, but clears media' do
it 'leaves the domains status and attachments, but clears media', :sidekiq_inline do
expect { bad_status_plain.reload }.to_not raise_error
expect { bad_status_with_attachment.reload }.to_not raise_error
expect { bad_attachment.reload }.to_not raise_error

View file

@ -31,7 +31,7 @@ RSpec.describe BlockService, type: :service do
expect(sender.blocking?(bob)).to be true
end
it 'sends a block activity' do
it 'sends a block activity', :sidekiq_inline do
expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
end
end

View file

@ -12,7 +12,7 @@ RSpec.describe BulkImportService do
import.update(total_items: import.rows.count)
end
describe '#call', :sidekiq_fake do
describe '#call' do
context 'when importing follows' do
let(:import_type) { 'following' }
let(:overwrite) { false }

View file

@ -110,7 +110,7 @@ RSpec.describe DeleteAccountService, type: :service do
end
end
describe '#call on local account' do
describe '#call on local account', :sidekiq_inline do
before do
stub_request(:post, remote_alice.inbox_url).to_return(status: 201)
stub_request(:post, remote_bob.inbox_url).to_return(status: 201)
@ -131,7 +131,7 @@ RSpec.describe DeleteAccountService, type: :service do
end
end
describe '#call on remote account' do
describe '#call on remote account', :sidekiq_inline do
before do
stub_request(:post, account.inbox_url).to_return(status: 201)
end

View file

@ -88,11 +88,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_account(bob, alice) }
let!(:empty_antenna) { antenna_with_account(tom, bob) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -100,7 +100,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
context 'when blocked' do
let!(:empty_antenna) { antenna_with_account(ohagi, alice) }
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -109,7 +109,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
let(:last_active_at_tom) { Time.now.utc.ago(1.year) }
let!(:empty_antenna) { antenna_with_account(tom, alice) }
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -119,11 +119,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_domain(bob, 'fast.example.com') }
let!(:empty_antenna) { antenna_with_domain(tom, 'ohagi.example.com') }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -133,18 +133,18 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_domain(bob, 'cb6e6126.ngrok.io') }
let!(:empty_antenna) { antenna_with_domain(tom, 'ohagi.example.com') }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
context 'when local timeline is disabled' do
let(:ltl_enabled) { false }
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -155,11 +155,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_tag(bob, 'hoge') }
let!(:empty_antenna) { antenna_with_tag(tom, 'hog') }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -168,11 +168,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_keyword(bob, 'body') }
let!(:empty_antenna) { antenna_with_keyword(tom, 'anime') }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -182,11 +182,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_keyword(bob, 'some') }
let!(:empty_antenna) { antenna_with_keyword(tom, 'anime') }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -196,11 +196,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_keyword(bob, 'body') }
let!(:empty_antenna) { antenna_with_keyword(tom, 'anime') }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -210,11 +210,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_domain(bob, 'fast.example.com', exclude_accounts: [tom.id]) }
let!(:empty_antenna) { antenna_with_domain(tom, 'fast.example.com', exclude_accounts: [alice.id]) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -224,11 +224,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_domain(bob, 'fast.example.com', exclude_keywords: ['aaa']) }
let!(:empty_antenna) { antenna_with_domain(tom, 'fast.example.com', exclude_keywords: ['body']) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -238,11 +238,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_domain(bob, 'fast.example.com') }
let!(:empty_antenna) { antenna_with_domain(tom, 'fast.example.com', exclude_tags: [Tag.find_or_create_by_names(['hoge']).first.id]) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -252,11 +252,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_keyword(bob, 'body', exclude_domains: ['ohagi.example.com']) }
let!(:empty_antenna) { antenna_with_keyword(tom, 'body', exclude_domains: ['fast.example.com']) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -265,7 +265,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_keyword(bob, 'body') }
let!(:empty_antenna) { antenna_with_keyword(tom, 'body') }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to include status.id
end
@ -276,7 +276,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:empty_antenna) { antenna_with_keyword(tom, 'body') }
[1, 2, 3, 4, 5].each do |_|
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to include status.id
end
@ -287,7 +287,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_keyword(bob, 'body', insert_feeds: true) }
let!(:empty_antenna) { antenna_with_keyword(tom, 'body', insert_feeds: true) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(home_feed_of(bob)).to include status.id
expect(antenna_feed_of(empty_antenna)).to include status.id
@ -299,7 +299,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
let!(:antenna) { antenna_with_keyword(bob, 'body', insert_feeds: true, list: list(bob)) }
let!(:empty_antenna) { antenna_with_keyword(tom, 'body', insert_feeds: true, list: list(tom)) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(list_feed_of(antenna.list)).to include status.id
expect(antenna_feed_of(empty_antenna)).to include status.id
@ -313,11 +313,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
let(:visibility) { :unlisted }
context 'when public searchability' do
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -325,11 +325,11 @@ RSpec.describe DeliveryAntennaService, type: :service do
context 'when public_unlisted searchability' do
let(:searchability) { :public_unlisted }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -337,7 +337,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
context 'when private searchability' do
let(:searchability) { :private }
it 'not detecting antenna' do
it 'not detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -350,7 +350,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
let(:visibility) { :unlisted }
context 'when public searchability' do
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to include status.id
end
@ -359,7 +359,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
context 'when public_unlisted searchability' do
let(:searchability) { :public_unlisted }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to include status.id
end
@ -368,7 +368,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
context 'when private searchability' do
let(:searchability) { :private }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to include status.id
end
@ -379,7 +379,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
let(:mode) { :stl }
let!(:antenna) { antenna_with_keyword(bob, 'anime', stl: true) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end
@ -388,7 +388,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
let(:mode) { :ltl }
let!(:antenna) { antenna_with_keyword(bob, 'anime', ltl: true) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end
@ -397,7 +397,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
let(:mode) { :stl }
let!(:antenna) { antenna_with_keyword(bob, 'anime', exclude_keywords: ['body'], stl: true) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end
@ -406,7 +406,7 @@ RSpec.describe DeliveryAntennaService, type: :service do
let(:mode) { :ltl }
let!(:antenna) { antenna_with_keyword(bob, 'anime', exclude_keywords: ['body'], ltl: true) }
it 'detecting antenna' do
it 'detecting antenna', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end

View file

@ -168,7 +168,7 @@ RSpec.describe EmojiReactService, type: :service do
stub_request(:post, 'https://author.foo.bar/inbox')
end
it 'react with emoji' do
it 'react with emoji', :sidekiq_inline do
expect(subject.count).to eq 1
expect(a_request(:post, 'https://author.foo.bar/inbox').with(body: hash_including({
type: 'Like',
@ -185,7 +185,7 @@ RSpec.describe EmojiReactService, type: :service do
stub_request(:post, 'https://foo.bar/inbox')
end
it 'react with emoji' do
it 'react with emoji', :sidekiq_inline do
expect(subject.count).to eq 1
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
type: 'Like',
@ -204,7 +204,7 @@ RSpec.describe EmojiReactService, type: :service do
stub_request(:post, 'https://foo.bar/inbox')
end
it 'react with emoji' do
it 'react with emoji', :sidekiq_inline do
expect(subject.count).to eq 1
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
type: 'Like',
@ -220,7 +220,7 @@ RSpec.describe EmojiReactService, type: :service do
stub_request(:post, 'https://foo.bar/inbox')
end
it 'react with emoji' do
it 'react with emoji', :sidekiq_inline do
expect(subject.count).to eq 1
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
type: 'Like',
@ -236,7 +236,7 @@ RSpec.describe EmojiReactService, type: :service do
stub_request(:post, 'https://foo.bar/inbox')
end
it 'react with emoji' do
it 'react with emoji', :sidekiq_inline do
expect(subject.count).to eq 1
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
type: 'Like',

View file

@ -37,6 +37,8 @@ RSpec.describe FanOutOnWriteService, type: :service do
ProcessMentionsService.new.call(status)
ProcessHashtagsService.new.call(status)
Fabricate(:media_attachment, status: status, account: alice)
allow(redis).to receive(:publish)
tag = status.tags.first
@ -83,38 +85,43 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when status is public' do
let(:visibility) { 'public' }
it 'is added to the home feed of its author' do
it 'is added to the home feed of its author', :sidekiq_inline do
expect(home_feed_of(alice)).to include status.id
end
it 'is added to the home feed of a follower' do
it 'is added to the home feed of the mentioned follower', :sidekiq_inline do
expect(home_feed_of(bob)).to include status.id
end
it 'is added to the home feed of a follower', :sidekiq_inline do
expect(home_feed_of(bob)).to include status.id
expect(home_feed_of(tom)).to include status.id
end
it 'is added to the tag follower' do
it 'is added to the tag follower', :sidekiq_inline do
expect(home_feed_of(tagf)).to include status.id
end
it 'is broadcast to the hashtag stream' do
it 'is broadcast to the hashtag stream', :sidekiq_inline do
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge:local', anything)
end
it 'is broadcast to the public stream' do
it 'is broadcast to the public stream', :sidekiq_inline do
expect(redis).to have_received(:publish).with('timeline:public', anything)
expect(redis).to have_received(:publish).with('timeline:public:local', anything)
expect(redis).to have_received(:publish).with('timeline:public:media', anything)
end
context 'when local timeline is disabled' do
context 'when local timeline is disabled', :sidekiq_inline do
let(:ltl_enabled) { false }
it 'is broadcast to the hashtag stream' do
it 'is broadcast to the hashtag stream', :sidekiq_inline do
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge:local', anything)
end
it 'is broadcast to the public stream' do
it 'is broadcast to the public stream', :sidekiq_inline do
expect(redis).to have_received(:publish).with('timeline:public', anything)
expect(redis).to_not have_received(:publish).with('timeline:public:local', anything)
end
@ -124,7 +131,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:list) { list_with_account(bob, alice) }
let!(:empty_list) { Fabricate(:list, account: tom) }
it 'is added to the list feed of list follower' do
it 'is added to the list feed of list follower', :sidekiq_inline do
expect(list_feed_of(list)).to include status.id
expect(list_feed_of(empty_list)).to_not include status.id
end
@ -134,7 +141,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_account(bob, alice) }
let!(:empty_antenna) { antenna_with_account(tom, bob) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -142,7 +149,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when subscription is blocked' do
let(:subscription_policy) { :block }
it 'is not added to the antenna feed' do
it 'is not added to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
end
end
@ -151,14 +158,14 @@ RSpec.describe FanOutOnWriteService, type: :service do
let(:subscription_policy) { :followers_only }
let!(:antenna) { antenna_with_account(ohagi, alice) }
it 'is not added to the antenna feed' do
it 'is not added to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
end
context 'with following' do
let!(:antenna) { antenna_with_account(bob, alice) }
it 'is added to the antenna feed' do
it 'is added to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end
@ -174,7 +181,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
end
context 'with listening tag' do
it 'is added to the antenna feed' do
it 'is added to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end
@ -182,7 +189,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'with listening tag but sender is limiting subscription' do
let(:subscription_policy) { :block }
it 'does not add to the antenna feed' do
it 'does not add to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
end
end
@ -197,7 +204,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
subject.call(status)
end
it 'is added to the antenna feed' do
it 'is added to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end
@ -208,7 +215,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_options(bob, stl: true) }
let!(:empty_antenna) { antenna_with_options(tom) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -216,7 +223,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when subscription is blocked' do
let(:subscription_policy) { :block }
it 'is added to the antenna feed' do
it 'is added to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end
@ -235,7 +242,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_options(bob, ltl: true) }
let!(:empty_antenna) { antenna_with_options(tom) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -243,7 +250,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when subscription is blocked' do
let(:subscription_policy) { :block }
it 'is added to the antenna feed' do
it 'is added to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end
@ -251,14 +258,14 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when local timeline is disabled' do
let(:ltl_enabled) { false }
it 'is not added to the antenna feed of antenna follower' do
it 'is not added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
end
context 'when handling status updates', :sidekiq_fake do
context 'when handling status updates' do
before do
subject.call(status)
@ -267,8 +274,6 @@ RSpec.describe FanOutOnWriteService, type: :service do
status.snapshot!(account_id: status.account_id)
redis.set("subscribed:timeline:#{eve.id}:notifications", '1')
Sidekiq::Worker.clear_all
end
it 'pushes the update to mentioned users through the notifications streaming channel' do
@ -281,23 +286,23 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when status is limited' do
let(:visibility) { 'limited' }
it 'is added to the home feed of its author' do
it 'is added to the home feed of its author', :sidekiq_inline do
expect(home_feed_of(alice)).to include status.id
end
it 'is added to the home feed of the mentioned follower' do
it 'is added to the home feed of the mentioned follower', :sidekiq_inline do
expect(home_feed_of(bob)).to include status.id
end
it 'is not added to the home feed of the other follower' do
it 'is not added to the home feed of the other follower', :sidekiq_inline do
expect(home_feed_of(tom)).to_not include status.id
end
it 'is not added to the tag follower' do
it 'is not added to the tag follower', :sidekiq_inline do
expect(home_feed_of(tagf)).to_not include status.id
end
it 'is not broadcast publicly' do
it 'is not broadcast publicly', :sidekiq_inline do
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to_not have_received(:publish).with('timeline:public', anything)
end
@ -306,7 +311,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:list) { list_with_account(bob, alice) }
let!(:empty_list) { list_with_account(tom, alice) }
it 'is added to the list feed of list follower' do
it 'is added to the list feed of list follower', :sidekiq_inline do
expect(list_feed_of(list)).to include status.id
expect(list_feed_of(empty_list)).to_not include status.id
end
@ -316,7 +321,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_account(bob, alice) }
let!(:empty_antenna) { antenna_with_account(tom, alice) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -326,7 +331,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_options(bob, stl: true) }
let!(:empty_antenna) { antenna_with_options(tom, stl: true) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -335,7 +340,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'with LTL antenna' do
let!(:empty_antenna) { antenna_with_options(bob, ltl: true) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -344,29 +349,33 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when status is private' do
let(:visibility) { 'private' }
it 'is added to the home feed of its author' do
it 'is added to the home feed of its author', :sidekiq_inline do
expect(home_feed_of(alice)).to include status.id
end
it 'is added to the home feed of a follower' do
it 'is added to the home feed of a follower', :sidekiq_inline do
expect(home_feed_of(bob)).to include status.id
expect(home_feed_of(tom)).to include status.id
end
it 'is not added to the tag follower' do
it 'is not added to the tag follower', :sidekiq_inline do
expect(home_feed_of(tagf)).to_not include status.id
end
it 'is not broadcast publicly' do
it 'is not broadcast publicly', :sidekiq_inline do
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to_not have_received(:publish).with('timeline:public', anything)
end
it 'is added to the home feed of the mentioned follower', :sidekiq_inline do
expect(home_feed_of(bob)).to include status.id
end
context 'with list' do
let!(:list) { list_with_account(bob, alice) }
let!(:empty_list) { list_with_account(ohagi, bob) }
it 'is added to the list feed of list follower' do
it 'is added to the list feed of list follower', :sidekiq_inline do
expect(list_feed_of(list)).to include status.id
expect(list_feed_of(empty_list)).to_not include status.id
end
@ -376,7 +385,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_account(bob, alice) }
let!(:empty_antenna) { antenna_with_account(ohagi, alice) }
it 'is added to the list feed of list follower' do
it 'is added to the list feed of list follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -386,7 +395,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_options(bob, stl: true) }
let!(:empty_antenna) { antenna_with_options(ohagi, stl: true) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -394,7 +403,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when local timeline is disabled' do
let(:ltl_enabled) { false }
it 'is not added to the antenna feed of antenna follower' do
it 'is not added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -404,14 +413,14 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'with LTL antenna' do
let!(:empty_antenna) { antenna_with_options(bob, ltl: true) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
context 'when local timeline is disabled' do
let(:ltl_enabled) { false }
it 'is not added to the antenna feed of antenna follower' do
it 'is not added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -421,20 +430,20 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when status is public_unlisted' do
let(:visibility) { 'public_unlisted' }
it 'is added to the home feed of its author' do
it 'is added to the home feed of its author', :sidekiq_inline do
expect(home_feed_of(alice)).to include status.id
end
it 'is added to the home feed of a follower' do
it 'is added to the home feed of a follower', :sidekiq_inline do
expect(home_feed_of(bob)).to include status.id
expect(home_feed_of(tom)).to include status.id
end
it 'is added to the tag follower' do
it 'is added to the tag follower', :sidekiq_inline do
expect(home_feed_of(tagf)).to include status.id
end
it 'is broadcast publicly' do
it 'is broadcast publicly', :sidekiq_inline do
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to have_received(:publish).with('timeline:public:local', anything)
expect(redis).to have_received(:publish).with('timeline:public', anything)
@ -443,12 +452,12 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when local timeline is disabled' do
let(:ltl_enabled) { false }
it 'is broadcast to the hashtag stream' do
it 'is broadcast to the hashtag stream', :sidekiq_inline do
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge:local', anything)
end
it 'is broadcast to the public stream' do
it 'is broadcast to the public stream', :sidekiq_inline do
expect(redis).to have_received(:publish).with('timeline:public', anything)
expect(redis).to_not have_received(:publish).with('timeline:public:local', anything)
end
@ -458,7 +467,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:list) { list_with_account(bob, alice) }
let!(:empty_list) { list_with_account(ohagi, bob) }
it 'is added to the list feed of list follower' do
it 'is added to the list feed of list follower', :sidekiq_inline do
expect(list_feed_of(list)).to include status.id
expect(list_feed_of(empty_list)).to_not include status.id
end
@ -468,7 +477,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_account(bob, alice) }
let!(:empty_antenna) { antenna_with_account(tom, bob) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -476,7 +485,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when subscription is blocked' do
let(:subscription_policy) { :block }
it 'is not added to the antenna feed' do
it 'is not added to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
end
end
@ -486,7 +495,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_options(bob, stl: true) }
let!(:empty_antenna) { antenna_with_options(tom) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -494,7 +503,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when subscription is blocked' do
let(:subscription_policy) { :block }
it 'is added to the antenna feed' do
it 'is added to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end
@ -502,7 +511,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when local timeline is disabled' do
let(:ltl_enabled) { false }
it 'is not added to the antenna feed of antenna follower' do
it 'is not added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -513,7 +522,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_options(bob, ltl: true) }
let!(:empty_antenna) { antenna_with_options(tom) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -521,7 +530,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when subscription is blocked' do
let(:subscription_policy) { :block }
it 'is added to the antenna feed' do
it 'is added to the antenna feed', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
end
end
@ -529,7 +538,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when local timeline is disabled' do
let(:ltl_enabled) { false }
it 'is not added to the antenna feed of antenna follower' do
it 'is not added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -540,20 +549,20 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when status is unlisted' do
let(:visibility) { 'unlisted' }
it 'is added to the home feed of its author' do
it 'is added to the home feed of its author', :sidekiq_inline do
expect(home_feed_of(alice)).to include status.id
end
it 'is added to the home feed of a follower' do
it 'is added to the home feed of a follower', :sidekiq_inline do
expect(home_feed_of(bob)).to include status.id
expect(home_feed_of(tom)).to include status.id
end
it 'is added to the tag follower' do
it 'is added to the tag follower', :sidekiq_inline do
expect(home_feed_of(tagf)).to include status.id
end
it 'is not broadcast publicly' do
it 'is not broadcast publicly', :sidekiq_inline do
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to_not have_received(:publish).with('timeline:public', anything)
end
@ -561,12 +570,12 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'with searchability public_unlisted' do
let(:searchability) { 'public_unlisted' }
it 'is broadcast to the hashtag stream' do
it 'is broadcast to the hashtag stream', :sidekiq_inline do
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge:local', anything)
end
it 'is added to the tag follower' do
it 'is added to the tag follower', :sidekiq_inline do
expect(home_feed_of(tagf)).to include status.id
end
end
@ -574,12 +583,12 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'with searchability private' do
let(:searchability) { 'private' }
it 'is not broadcast to the hashtag stream' do
it 'is not broadcast to the hashtag stream', :sidekiq_inline do
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge:local', anything)
end
it 'is not added to the tag follower' do
it 'is not added to the tag follower', :sidekiq_inline do
expect(home_feed_of(tagf)).to_not include status.id
end
end
@ -587,7 +596,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when local timeline is disabled' do
let(:ltl_enabled) { false }
it 'is broadcast to the hashtag stream' do
it 'is broadcast to the hashtag stream', :sidekiq_inline do
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge:local', anything)
end
@ -597,7 +606,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:list) { list_with_account(bob, alice) }
let!(:empty_list) { list_with_account(ohagi, bob) }
it 'is added to the list feed of list follower' do
it 'is added to the list feed of list follower', :sidekiq_inline do
expect(list_feed_of(list)).to include status.id
expect(list_feed_of(empty_list)).to_not include status.id
end
@ -607,7 +616,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_account(bob, alice) }
let!(:empty_antenna) { antenna_with_account(ohagi, alice) }
it 'is added to the list feed of list follower' do
it 'is added to the list feed of list follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -617,7 +626,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_options(bob, stl: true) }
let!(:empty_antenna) { antenna_with_options(ohagi, stl: true) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -625,7 +634,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when local timeline is disabled' do
let(:ltl_enabled) { false }
it 'is not added to the antenna feed of antenna follower' do
it 'is not added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -635,14 +644,14 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'with LTL antenna' do
let!(:empty_antenna) { antenna_with_options(bob, ltl: true) }
it 'is added to the antenna feed of antenna follower' do
it 'is added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
context 'when local timeline is disabled' do
let(:ltl_enabled) { false }
it 'is not added to the antenna feed of antenna follower' do
it 'is not added to the antenna feed of antenna follower', :sidekiq_inline do
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
end
@ -651,7 +660,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'with non-public searchability' do
let(:searchability) { 'direct' }
it 'hashtag-timeline is not detected' do
it 'hashtag-timeline is not detected', :sidekiq_inline do
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to_not have_received(:publish).with('timeline:public', anything)
end
@ -661,23 +670,23 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when status is direct' do
let(:visibility) { 'direct' }
it 'is added to the home feed of its author' do
it 'is added to the home feed of its author', :sidekiq_inline do
expect(home_feed_of(alice)).to include status.id
end
it 'is added to the home feed of the mentioned follower' do
it 'is added to the home feed of the mentioned follower', :sidekiq_inline do
expect(home_feed_of(bob)).to include status.id
end
it 'is not added to the home feed of the other follower' do
it 'is not added to the home feed of the other follower', :sidekiq_inline do
expect(home_feed_of(tom)).to_not include status.id
end
it 'is not added to the tag follower' do
it 'is not added to the tag follower', :sidekiq_inline do
expect(home_feed_of(tagf)).to_not include status.id
end
it 'is not broadcast publicly' do
it 'is not broadcast publicly', :sidekiq_inline do
expect(redis).to_not have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to_not have_received(:publish).with('timeline:public', anything)
end
@ -686,7 +695,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:list) { list_with_account(bob, alice) }
let!(:empty_list) { list_with_account(ohagi, bob) }
it 'is added to the list feed of list follower' do
it 'is added to the list feed of list follower', :sidekiq_inline do
expect(list_feed_of(list)).to_not include status.id
expect(list_feed_of(empty_list)).to_not include status.id
end
@ -696,7 +705,7 @@ RSpec.describe FanOutOnWriteService, type: :service do
let!(:antenna) { antenna_with_account(bob, alice) }
let!(:empty_antenna) { antenna_with_account(ohagi, alice) }
it 'is added to the list feed of list follower' do
it 'is added to the list feed of list follower', :sidekiq_inline do
expect(antenna_feed_of(antenna)).to_not include status.id
expect(antenna_feed_of(empty_antenna)).to_not include status.id
end
@ -724,28 +733,28 @@ RSpec.describe FanOutOnWriteService, type: :service do
end
context 'when public visibility' do
it 'does not create notification' do
it 'does not create notification', :sidekiq_inline do
notification = Notification.find_by(account: bob, type: 'mention')
expect(notification).to be_nil
end
it 'creates notification for active mention' do
it 'creates notification for active mention', :sidekiq_inline do
notification = Notification.find_by(account: tom, type: 'mention')
expect(notification).to_not be_nil
expect(notification.mention.status_id).to eq status.id
end
it 'inserts home feed for reply' do
it 'inserts home feed for reply', :sidekiq_inline do
expect(home_feed_of(bob)).to include status.id
end
it 'inserts home feed for non-replied but mentioned and following replied account' do
it 'inserts home feed for non-replied but mentioned and following replied account', :sidekiq_inline do
expect(home_feed_of(zilu)).to include status.id
end
it 'does not insert home feed for non-replied, non-following replied account but mentioned' do
it 'does not insert home feed for non-replied, non-following replied account but mentioned', :sidekiq_inline do
expect(home_feed_of(tom)).to_not include status.id
end
end
@ -753,29 +762,29 @@ RSpec.describe FanOutOnWriteService, type: :service do
context 'when limited visibility' do
let(:visibility) { :limited }
it 'creates notification' do
it 'creates notification', :sidekiq_inline do
notification = Notification.find_by(account: bob, type: 'mention')
expect(notification).to_not be_nil
expect(notification.mention.status_id).to eq status.id
end
it 'creates notification for other conversation account' do
it 'creates notification for other conversation account', :sidekiq_inline do
notification = Notification.find_by(account: ohagi, type: 'mention')
expect(notification).to_not be_nil
expect(notification.mention.status_id).to eq status.id
end
it 'inserts home feed for reply' do
it 'inserts home feed for reply', :sidekiq_inline do
expect(home_feed_of(bob)).to include status.id
end
it 'inserts home feed for non-replied but mentioned and following replied account' do
it 'inserts home feed for non-replied but mentioned and following replied account', :sidekiq_inline do
expect(home_feed_of(zilu)).to include status.id
end
it 'does not insert home feed for non-replied, non-following replied account but mentioned' do
it 'does not insert home feed for non-replied, non-following replied account but mentioned', :sidekiq_inline do
expect(home_feed_of(tom)).to_not include status.id
end
end
@ -791,21 +800,21 @@ RSpec.describe FanOutOnWriteService, type: :service do
subject.call(status, update: true)
end
it 'notified to boosted account' do
it 'notified to boosted account', :sidekiq_inline do
notification = Notification.find_by(account: bob, type: 'update')
expect(notification).to_not be_nil
expect(notification.activity_id).to eq status.id
end
it 'notified to quoted account' do
it 'notified to quoted account', :sidekiq_inline do
notification = Notification.find_by(account: tom, type: 'update')
expect(notification).to_not be_nil
expect(notification.activity_id).to eq status.id
end
it 'notified not to non-boosted account' do
it 'notified not to non-boosted account', :sidekiq_inline do
notification = Notification.find_by(account: ohagi, type: 'update')
expect(notification).to be_nil

View file

@ -33,7 +33,7 @@ RSpec.describe FavouriteService, type: :service do
expect(status.favourites.first).to_not be_nil
end
it 'sends a like activity' do
it 'sends a like activity', :sidekiq_inline do
expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
end
end

View file

@ -150,7 +150,7 @@ RSpec.describe FollowService, type: :service do
expect(FollowRequest.find_by(account: sender, target_account: bob)).to_not be_nil
end
it 'sends a follow activity to the inbox' do
it 'sends a follow activity to the inbox', :sidekiq_inline do
expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
end
end

View file

@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe ImportService, type: :service do
RSpec.describe ImportService, :sidekiq_inline, type: :service do
include RoutingHelper
let!(:account) { Fabricate(:account, locked: false) }

View file

@ -17,7 +17,7 @@ RSpec.describe MuteService, type: :service do
redis.del(home_timeline_key)
end
it "clears account's statuses" do
it "clears account's statuses", :sidekiq_inline do
FeedManager.instance.push_to_home(account, status)
FeedManager.instance.push_to_home(account, other_account_status)

View file

@ -166,7 +166,7 @@ RSpec.describe NotifyService, type: :service do
context 'when email notification is enabled' do
let(:enabled) { true }
it 'sends email' do
it 'sends email', :sidekiq_inline do
expect { subject }.to change(ActionMailer::Base.deliveries, :count).by(1)
end
end

View file

@ -34,14 +34,14 @@ RSpec.describe ProcessReferencesService, type: :service do
context 'when a simple case' do
let(:text) { "Hello RT #{target_status_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject.pluck(0)).to include target_status.id
expect(subject.pluck(1)).to include 'RT'
expect(notify?).to be true
end
it 'not quote' do
it 'not quote', :sidekiq_inline do
expect(status.quote).to be_nil
end
end
@ -51,7 +51,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:target_status2_uri) { ActivityPub::TagManager.instance.uri_for(target_status2) }
let(:text) { "Hello RT #{target_status_uri}\nBT #{target_status2_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 2
expect(subject).to include [target_status.id, 'RT']
expect(subject).to include [target_status2.id, 'BT']
@ -64,7 +64,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "Hello RT #{target_status_uri}" }
let(:visibility) { :private }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject.pluck(0)).to include target_status.id
expect(subject.pluck(1)).to include 'RT'
@ -76,7 +76,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "Hello RT #{target_status_uri}" }
let(:target_status_visibility) { :private }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 0
expect(notify?).to be false
end
@ -85,7 +85,7 @@ RSpec.describe ProcessReferencesService, type: :service do
context 'with quote' do
let(:text) { "Hello QT #{target_status_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject.pluck(0)).to include target_status.id
expect(subject.pluck(1)).to include 'QT'
@ -99,7 +99,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { 'Hello' }
let(:quote_urls) { [ActivityPub::TagManager.instance.uri_for(target_status)] }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject.pluck(0)).to include target_status.id
expect(subject.pluck(1)).to include 'QT'
@ -113,7 +113,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "Hello QT #{target_status_uri}" }
let(:quote_urls) { [ActivityPub::TagManager.instance.uri_for(target_status)] }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject.pluck(0)).to include target_status.id
expect(subject.pluck(1)).to include 'QT'
@ -127,7 +127,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "Hello RE #{target_status_uri}" }
let(:quote_urls) { [ActivityPub::TagManager.instance.uri_for(target_status)] }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject.pluck(0)).to include target_status.id
expect(subject.pluck(1)).to include 'QT'
@ -141,7 +141,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "Hello QT #{target_status_uri}" }
let(:allow_quote) { false }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject.pluck(0)).to include target_status.id
expect(subject.pluck(1)).to include 'BT'
@ -155,7 +155,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:target_status2_uri) { ActivityPub::TagManager.instance.uri_for(target_status2) }
let(:text) { "Hello QT #{target_status_uri}\nBT #{target_status2_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 2
expect(subject).to include [target_status.id, 'QT']
expect(subject).to include [target_status2.id, 'BT']
@ -169,7 +169,7 @@ RSpec.describe ProcessReferencesService, type: :service do
context 'when url only' do
let(:text) { "Hello #{target_status_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 0
expect(notify?).to be false
end
@ -197,7 +197,7 @@ RSpec.describe ProcessReferencesService, type: :service do
stub_request(:get, 'https://example.com/not_found').to_return(status: 404)
end
it 'reference it' do
it 'reference it', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject[0][1]).to eq 'BT'
@ -209,7 +209,7 @@ RSpec.describe ProcessReferencesService, type: :service do
context 'with fetch_remote later' do
let(:fetch_remote) { false }
it 'reference it' do
it 'reference it', :sidekiq_inline do
ids = subject.pluck(0)
expect(ids.size).to eq 1
@ -223,7 +223,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:fetch_remote) { false }
let(:text) { "RT #{ActivityPub::TagManager.instance.uri_for(target_status)} BT https://example.com/test_post" }
it 'reference it' do
it 'reference it', :sidekiq_inline do
expect(subject.size).to eq 2
expect(subject).to include [target_status.id, 'RT']
expect(subject.pluck(1)).to include 'BT'
@ -236,7 +236,7 @@ RSpec.describe ProcessReferencesService, type: :service do
context 'with not exists reference' do
let(:text) { 'BT https://example.com/not_found' }
it 'reference it' do
it 'reference it', :sidekiq_inline do
expect(subject.size).to eq 0
end
end
@ -259,7 +259,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { 'BT:https://example.com/test_post' }
shared_examples 'reference once' do |uri, url|
it 'reference it' do
it 'reference it', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject[0][1]).to eq 'BT'
@ -299,7 +299,7 @@ RSpec.describe ProcessReferencesService, type: :service do
it_behaves_like 'reference once', 'https://example.com/test_post', 'https://example.com/test_post_ohagi'
it 'do not request to uri' do
it 'do not request to uri', :sidekiq_inline do
subject
expect(a_request(:get, 'https://example.com/test_post_ohagi')).to_not have_been_made
end
@ -335,7 +335,7 @@ RSpec.describe ProcessReferencesService, type: :service do
context 'when add reference to empty' do
let(:new_text) { "BT #{target_status_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject).to include target_status.id
expect(notify?).to be true
@ -346,7 +346,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "BT #{target_status_uri}" }
let(:new_text) { "BT #{target_status_uri}\nBT #{target_status2_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 2
expect(subject).to include target_status.id
expect(subject).to include target_status2.id
@ -358,7 +358,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "BT #{target_status_uri}" }
let(:new_text) { "BT #{target_status_uri}\nBT #{target_status_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject).to include target_status.id
end
@ -368,7 +368,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "BT #{target_status_uri}" }
let(:new_text) { 'Hello' }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 0
expect(notify?).to be false
end
@ -378,7 +378,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "QT #{target_status_uri}" }
let(:new_text) { 'Hello' }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 0
expect(status.quote).to be_nil
expect(notify?).to be false
@ -389,7 +389,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "BT #{target_status_uri}" }
let(:new_text) { "BT #{target_status2_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject).to include target_status2.id
expect(notify?(target_status2.id)).to be true
@ -400,7 +400,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "QT #{target_status_uri}" }
let(:new_text) { "QT #{target_status2_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject).to include target_status2.id
expect(status.quote).to_not be_nil
@ -413,7 +413,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "QT #{target_status_uri}" }
let(:new_text) { "RT #{target_status_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject).to include target_status.id
expect(status.quote).to be_nil
@ -425,7 +425,7 @@ RSpec.describe ProcessReferencesService, type: :service do
let(:text) { "RT #{target_status_uri}" }
let(:new_text) { "QT #{target_status_uri}" }
it 'post status' do
it 'post status', :sidekiq_inline do
expect(subject.size).to eq 1
expect(subject).to include target_status.id
expect(status.quote).to_not be_nil

View file

@ -87,7 +87,7 @@ RSpec.describe ReblogService, type: :service do
expect(ActivityPub::DistributionWorker).to have_received(:perform_async)
end
it 'sends an announce activity to the author' do
it 'sends an announce activity to the author', :sidekiq_inline do
expect(a_request(:post, bob.inbox_url)).to have_been_made.once
end
end

View file

@ -41,7 +41,7 @@ RSpec.describe RejectFollowService, type: :service do
expect(bob.following?(sender)).to be false
end
it 'sends a reject activity' do
it 'sends a reject activity', :sidekiq_inline do
expect(a_request(:post, bob.inbox_url)).to have_been_made.once
end
end

View file

@ -33,7 +33,7 @@ RSpec.describe RemoveFromFollowersService, type: :service do
expect(bob.followed_by?(sender)).to be false
end
it 'sends a reject activity' do
it 'sends a reject activity', :sidekiq_inline do
expect(a_request(:post, sender.inbox_url)).to have_been_made.once
end
end

View file

@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe RemoveStatusService, type: :service do
RSpec.describe RemoveStatusService, :sidekiq_inline, type: :service do
subject { described_class.new }
let!(:alice) { Fabricate(:account) }
@ -22,7 +22,8 @@ RSpec.describe RemoveStatusService, type: :service do
end
context 'when removed status is not a reblog' do
let!(:status) { PostStatusService.new.call(alice, text: "Hello @#{bob.pretty_acct} ThisIsASecret") }
let!(:media_attachment) { Fabricate(:media_attachment, account: alice) }
let!(:status) { PostStatusService.new.call(alice, text: "Hello @#{bob.pretty_acct} ThisIsASecret", media_ids: [media_attachment.id]) }
before do
FavouriteService.new.call(jeff, status)
@ -39,6 +40,14 @@ RSpec.describe RemoveStatusService, type: :service do
expect(HomeFeed.new(jeff).get(10).pluck(:id)).to_not include(status.id)
end
it 'publishes to public media timeline' do
allow(redis).to receive(:publish).with(any_args)
subject.call(status)
expect(redis).to have_received(:publish).with('timeline:public:media', Oj.dump(event: :delete, payload: status.id.to_s))
end
it 'sends Delete activity to followers' do
subject.call(status)
expect(a_request(:post, hank.shared_inbox_url).with(
@ -118,7 +127,7 @@ RSpec.describe RemoveStatusService, type: :service do
)).to have_been_made.once
end
it 'do not send Delete activity to followers' do
it 'do not send Delete activity to followers', :sidekiq_inline do
subject.call(status)
expect(a_request(:post, hank.inbox_url)).to_not have_been_made
expect(a_request(:post, hank.shared_inbox_url)).to_not have_been_made

View file

@ -23,7 +23,7 @@ RSpec.describe ReportService, type: :service do
stub_request(:post, 'http://example.com/inbox').to_return(status: 200)
end
context 'when forward is true' do
context 'when forward is true', :sidekiq_inline do
let(:forward) { true }
it 'sends ActivityPub payload when forward is true' do
@ -53,7 +53,7 @@ RSpec.describe ReportService, type: :service do
end
context 'when forward_to_domains includes only the replied-to domain' do
it 'sends ActivityPub payload only to the author of the replied-to post' do
it 'sends ActivityPub payload only to the author of the replied-to post', :sidekiq_inline do
subject.call(source_account, remote_account, status_ids: [reported_status.id], forward: forward, forward_to_domains: [remote_thread_account.domain])
expect(a_request(:post, 'http://foo.com/inbox')).to have_been_made
expect(a_request(:post, 'http://example.com/inbox')).to_not have_been_made
@ -61,7 +61,7 @@ RSpec.describe ReportService, type: :service do
end
context 'when forward_to_domains does not include the replied-to domain' do
it 'does not send ActivityPub payload to the author of the replied-to post' do
it 'does not send ActivityPub payload to the author of the replied-to post', :sidekiq_inline do
subject.call(source_account, remote_account, status_ids: [reported_status.id], forward: forward)
expect(a_request(:post, 'http://foo.com/inbox')).to_not have_been_made
end
@ -89,7 +89,7 @@ RSpec.describe ReportService, type: :service do
end
context 'when forward is false' do
it 'does not send anything' do
it 'does not send anything', :sidekiq_inline do
subject.call(source_account, remote_account, forward: forward)
expect(a_request(:post, 'http://example.com/inbox')).to_not have_been_made
end

View file

@ -199,7 +199,7 @@ RSpec.describe ResolveAccountService, type: :service do
expect(account.uri).to eq 'https://ap.example.com/users/foo'
end
it 'merges accounts' do
it 'merges accounts', :sidekiq_inline do
account = subject.call('foo@ap.example.com')
expect(status.reload.account_id).to eq account.id

View file

@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe SuspendAccountService, type: :service do
RSpec.describe SuspendAccountService, :sidekiq_inline, type: :service do
shared_examples 'common behavior' do
subject { described_class.new.call(account) }
@ -16,17 +16,24 @@ RSpec.describe SuspendAccountService, type: :service do
list.accounts << account
account.suspend!
Fabricate(:media_attachment, file: attachment_fixture('boop.ogg'), account: account)
end
it 'unmerges from feeds of local followers and preserves suspended flag' do
it 'unmerges from feeds of local followers and changes file mode and preserves suspended flag' do
expect { subject }
.to_not change_suspended_flag
.to change_file_mode
.and not_change_suspended_flag
expect(FeedManager.instance).to have_received(:unmerge_from_home).with(account, local_follower)
expect(FeedManager.instance).to have_received(:unmerge_from_list).with(account, list)
end
def change_suspended_flag
change(account, :suspended?)
def change_file_mode
change { File.stat(account.media_attachments.first.file.path).mode }
end
def not_change_suspended_flag
not_change(account, :suspended?)
end
end

View file

@ -90,7 +90,7 @@ RSpec.describe UnEmojiReactService, type: :service do
stub_request(:post, 'https://author.foo.bar/inbox')
end
it 'react with emoji' do
it 'react with emoji', :sidekiq_inline do
expect(subject.count).to eq 0
expect(a_request(:post, 'https://author.foo.bar/inbox').with(body: hash_including({
type: 'Undo',
@ -107,7 +107,7 @@ RSpec.describe UnEmojiReactService, type: :service do
stub_request(:post, 'https://foo.bar/inbox')
end
it 'react with emoji' do
it 'react with emoji', :sidekiq_inline do
expect(subject.count).to eq 0
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
type: 'Undo',
@ -127,7 +127,7 @@ RSpec.describe UnEmojiReactService, type: :service do
stub_request(:post, 'https://foo.bar/inbox')
end
it 'react with emoji' do
it 'react with emoji', :sidekiq_inline do
expect(subject.count).to eq 0
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
type: 'Undo',
@ -145,7 +145,7 @@ RSpec.describe UnEmojiReactService, type: :service do
stub_request(:post, 'https://foo.bar/inbox')
end
it 'react with emoji' do
it 'react with emoji', :sidekiq_inline do
expect(subject.count).to eq 0
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
type: 'Undo',
@ -163,7 +163,7 @@ RSpec.describe UnEmojiReactService, type: :service do
stub_request(:post, 'https://foo.bar/inbox')
end
it 'react with emoji' do
it 'react with emoji', :sidekiq_inline do
expect(subject.count).to eq 0
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
type: 'Undo',

View file

@ -12,7 +12,7 @@ RSpec.describe UnallowDomainService, type: :service do
let!(:already_banned_account) { Fabricate(:account, username: 'badguy', domain: 'evil.org', suspended: true, silenced: true) }
let!(:domain_allow) { Fabricate(:domain_allow, domain: 'evil.org') }
context 'with limited federation mode' do
context 'with limited federation mode', :sidekiq_inline do
before do
allow(Rails.configuration.x).to receive(:limited_federation_mode).and_return(true)
end

View file

@ -33,7 +33,7 @@ RSpec.describe UnblockService, type: :service do
expect(sender.blocking?(bob)).to be false
end
it 'sends an unblock activity' do
it 'sends an unblock activity', :sidekiq_inline do
expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
end
end

View file

@ -20,7 +20,7 @@ RSpec.describe UnfollowService, type: :service do
end
end
describe 'remote ActivityPub' do
describe 'remote ActivityPub', :sidekiq_inline do
let(:bob) { Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
before do
@ -38,7 +38,7 @@ RSpec.describe UnfollowService, type: :service do
end
end
describe 'remote ActivityPub (reverse)' do
describe 'remote ActivityPub (reverse)', :sidekiq_inline do
let(:bob) { Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
before do

View file

@ -45,7 +45,7 @@ RSpec.describe UnsuspendAccountService, type: :service do
remote_follower.follow!(account)
end
it 'merges back into feeds of local followers and sends update' do
it 'merges back into feeds of local followers and sends update', :sidekiq_inline do
subject
expect_feeds_merged

View file

@ -5,7 +5,7 @@ require 'rails_helper'
RSpec.describe UpdateAccountService, type: :service do
subject { described_class.new }
describe 'switching form locked to unlocked accounts' do
describe 'switching form locked to unlocked accounts', :sidekiq_inline do
let(:account) { Fabricate(:account, locked: true) }
let(:alice) { Fabricate(:account) }
let(:bob) { Fabricate(:account) }

View file

@ -111,7 +111,7 @@ RSpec.describe UpdateStatusService, type: :service do
end
end
context 'when poll changes', :sidekiq_fake do
context 'when poll changes' do
let(:account) { Fabricate(:account) }
let!(:status) { Fabricate(:status, text: 'Foo', account: account, poll_attributes: { options: %w(Foo Bar), account: account, multiple: false, hide_totals: false, expires_at: 7.days.from_now }) }
let!(:poll) { status.poll }