From 07e10e37477bdaa1bea30fbf2bebb05cf9ae793d Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 18 Jan 2024 04:36:59 -0500 Subject: [PATCH] Combine assertions about same setup in `Account#suspend!` spec (#28787) --- spec/models/account_spec.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index ab7457962..d360d934d 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -9,14 +9,10 @@ RSpec.describe Account do let(:bob) { Fabricate(:account, username: 'bob') } describe '#suspend!' do - it 'marks the account as suspended' do - subject.suspend! - expect(subject.suspended?).to be true - end - - it 'creates a deletion request' do - subject.suspend! - expect(AccountDeletionRequest.where(account: subject).exists?).to be true + it 'marks the account as suspended and creates a deletion request' do + expect { subject.suspend! } + .to change(subject, :suspended?).from(false).to(true) + .and(change { AccountDeletionRequest.exists?(account: subject) }.from(false).to(true)) end context 'when the account is of a local user' do