From cad8cc90baf721fc4269b8ac36d4411ce8fe8539 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 13 Oct 2023 09:50:46 -0400 Subject: [PATCH] Speed-up on `MoveWorker` spec (#25528) --- spec/workers/move_worker_spec.rb | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/spec/workers/move_worker_spec.rb b/spec/workers/move_worker_spec.rb index 7577f6e89..efad92c04 100644 --- a/spec/workers/move_worker_spec.rb +++ b/spec/workers/move_worker_spec.rb @@ -67,39 +67,31 @@ describe MoveWorker do end shared_examples 'block and mute handling' do - it 'makes blocks carry over and add a note' do + it 'makes blocks and mutes carry over and adds a note' do subject.perform(source_account.id, target_account.id) + expect(block_service).to have_received(:call).with(blocking_account, target_account) expect(AccountNote.find_by(account: blocking_account, target_account: target_account).comment).to include(source_account.acct) - end - it 'makes mutes carry over and add a note' do - subject.perform(source_account.id, target_account.id) expect(muting_account.muting?(target_account)).to be true expect(AccountNote.find_by(account: muting_account, target_account: target_account).comment).to include(source_account.acct) end end shared_examples 'followers count handling' do - it 'updates the source account followers count' do + it 'updates the source and target account followers counts' do subject.perform(source_account.id, target_account.id) - expect(source_account.reload.followers_count).to eq(source_account.passive_relationships.count) - end - it 'updates the target account followers count' do - subject.perform(source_account.id, target_account.id) + expect(source_account.reload.followers_count).to eq(source_account.passive_relationships.count) expect(target_account.reload.followers_count).to eq(target_account.passive_relationships.count) end end shared_examples 'lists handling' do - it 'puts the new account on the list' do + it 'puts the new account on the list and makes valid lists', sidekiq: :inline do subject.perform(source_account.id, target_account.id) - expect(list.accounts.include?(target_account)).to be true - end - it 'does not create invalid list memberships' do - subject.perform(source_account.id, target_account.id) + expect(list.accounts.include?(target_account)).to be true expect(ListAccount.all).to all be_valid end end