0
0
Fork 0

Reference value constants from specs (#33479)

This commit is contained in:
Matt Jankowski 2025-01-06 18:25:13 -05:00 committed by GitHub
parent b0634b2943
commit efcd4ea5de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 19 additions and 12 deletions

View file

@ -23,22 +23,30 @@ RSpec.describe BackupPolicy do
context 'when backups are too old' do
it 'permits' do
travel(-8.days) do
travel(-before_time) do
Fabricate(:backup, user: john.user)
end
expect(subject).to permit(john, Backup)
end
def before_time
described_class::MIN_AGE + 2.days
end
end
context 'when backups are newer' do
it 'denies' do
travel(-3.days) do
travel(-within_time) do
Fabricate(:backup, user: john.user)
end
expect(subject).to_not permit(john, Backup)
end
def within_time
described_class::MIN_AGE - 2.days
end
end
end
end