1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Refactor ActivityPub::RepliesController tests

This commit is contained in:
Claire 2022-05-21 11:21:30 +02:00
parent e069701c84
commit a96cf6f7de

View file

@ -8,6 +8,13 @@ RSpec.describe ActivityPub::RepliesController do
let(:remote_reply_id) { 'https://foobar.com/statuses/1234' }
let(:remote_querier) { nil }
let!(:reply1) { Fabricate(:status, thread: status, visibility: :public) }
let!(:reply2) { Fabricate(:status, thread: status, visibility: :public) }
let!(:reply3) { Fabricate(:status, thread: status, visibility: :private) }
let!(:reply4) { Fabricate(:status, account: status.account, thread: status, visibility: :public) }
let!(:reply5) { Fabricate(:status, account: status.account, thread: status, visibility: :private) }
let!(:reply6) { Fabricate(:status, account: remote_account, thread: status, visibility: :public, uri: remote_reply_id) }
shared_examples 'common behavior' do
context 'when status is private' do
let(:parent_visibility) { :private }
@ -152,14 +159,6 @@ RSpec.describe ActivityPub::RepliesController do
before do
stub_const 'ActivityPub::RepliesController::DESCENDANTS_LIMIT', 5
allow(controller).to receive(:signed_request_actor).and_return(remote_querier)
Fabricate(:status, thread: status, visibility: :public)
Fabricate(:status, thread: status, visibility: :public)
Fabricate(:status, thread: status, visibility: :private)
Fabricate(:status, account: status.account, thread: status, visibility: :public)
Fabricate(:status, account: status.account, thread: status, visibility: :private)
Fabricate(:status, account: remote_account, thread: status, visibility: :public, uri: remote_reply_id)
end
describe 'GET #index' do