From eea1cfe1a9d36141e8bbb7e6c0fce815caec27ce Mon Sep 17 00:00:00 2001 From: Claire Date: Sat, 21 May 2022 11:21:30 +0200 Subject: [PATCH] Refactor ActivityPub::RepliesController tests --- .../activitypub/replies_controller_spec.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/spec/controllers/activitypub/replies_controller_spec.rb b/spec/controllers/activitypub/replies_controller_spec.rb index d7c2c2d3b0..622cb48964 100644 --- a/spec/controllers/activitypub/replies_controller_spec.rb +++ b/spec/controllers/activitypub/replies_controller_spec.rb @@ -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 } @@ -177,14 +184,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