0
0
Fork 0

Fix RSpec/ExpectChange cop (#25101)

This commit is contained in:
Matt Jankowski 2023-05-24 05:23:40 -04:00 committed by GitHub
parent 1caa5ff39e
commit d2e5430d4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 24 additions and 41 deletions

View file

@ -103,7 +103,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
describe '#perform' do
context 'when the budget is lower than the number of toots to delete' do
it 'deletes as many statuses as the given budget' do
expect { subject.perform }.to change { Status.count }.by(-subject.compute_budget)
expect { subject.perform }.to change(Status, :count).by(-subject.compute_budget)
end
it 'does not delete from accounts with no cleanup policy' do
@ -117,7 +117,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
it 'eventually deletes every deletable toot given enough runs' do
stub_const 'Scheduler::AccountsStatusesCleanupScheduler::MAX_BUDGET', 4
expect { 10.times { subject.perform } }.to change { Status.count }.by(-30)
expect { 10.times { subject.perform } }.to change(Status, :count).by(-30)
end
it 'correctly round-trips between users across several runs' do
@ -125,7 +125,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
stub_const 'Scheduler::AccountsStatusesCleanupScheduler::PER_ACCOUNT_BUDGET', 2
expect { 3.times { subject.perform } }
.to change { Status.count }.by(-3 * 3)
.to change(Status, :count).by(-3 * 3)
.and change { account1.statuses.count }
.and change { account3.statuses.count }
.and change { account5.statuses.count }
@ -140,7 +140,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
it 'correctly handles looping in a single run' do
expect(subject.compute_budget).to eq(400)
expect { subject.perform }.to change { Status.count }.by(-30)
expect { subject.perform }.to change(Status, :count).by(-30)
end
end
@ -154,7 +154,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
it 'does not get stuck' do
expect(subject.compute_budget).to eq(400)
expect { subject.perform }.to_not change { Status.count }
expect { subject.perform }.to_not change(Status, :count)
end
end
end