Reduce factory creation (132 -> 40) in lib/vacuum/* specs (#32498)
This commit is contained in:
parent
d74c2c583a
commit
0cc21f1ded
6 changed files with 41 additions and 58 deletions
|
@ -11,16 +11,13 @@ RSpec.describe Vacuum::BackupsVacuum do
|
|||
let!(:expired_backup) { Fabricate(:backup, created_at: (retention_period + 1.day).ago) }
|
||||
let!(:current_backup) { Fabricate(:backup) }
|
||||
|
||||
before do
|
||||
it 'deletes backups past the retention period but preserves those within the period' do
|
||||
subject.perform
|
||||
end
|
||||
|
||||
it 'deletes backups past the retention period' do
|
||||
expect { expired_backup.reload }.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
it 'does not delete backups within the retention period' do
|
||||
expect { current_backup.reload }.to_not raise_error
|
||||
expect { expired_backup.reload }
|
||||
.to raise_error ActiveRecord::RecordNotFound
|
||||
expect { current_backup.reload }
|
||||
.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue