mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 16:59:41 +00:00
Reduce factory creation (132 -> 40) in lib/vacuum/* specs (#32498)
This commit is contained in:
@@ -15,24 +15,20 @@ RSpec.describe Vacuum::StatusesVacuum do
|
||||
let!(:local_status_old) { Fabricate(:status, created_at: (retention_period + 2.days).ago) }
|
||||
let!(:local_status_recent) { Fabricate(:status, created_at: (retention_period - 2.days).ago) }
|
||||
|
||||
before do
|
||||
it 'deletes remote statuses past the retention period and keeps others' do
|
||||
subject.perform
|
||||
end
|
||||
|
||||
it 'deletes remote statuses past the retention period' do
|
||||
expect { remote_status_old.reload }.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
expect { remote_status_old.reload }
|
||||
.to raise_error ActiveRecord::RecordNotFound
|
||||
|
||||
it 'does not delete local statuses past the retention period' do
|
||||
expect { local_status_old.reload }.to_not raise_error
|
||||
end
|
||||
expect { local_status_old.reload }
|
||||
.to_not raise_error
|
||||
|
||||
it 'does not delete remote statuses within the retention period' do
|
||||
expect { remote_status_recent.reload }.to_not raise_error
|
||||
end
|
||||
expect { remote_status_recent.reload }
|
||||
.to_not raise_error
|
||||
|
||||
it 'does not delete local statuses within the retention period' do
|
||||
expect { local_status_recent.reload }.to_not raise_error
|
||||
expect { local_status_recent.reload }
|
||||
.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user