mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Use app time zone when calculating valid_to, outzone_at and delete_at domain attributes
#235
This commit is contained in:
parent
8dc65a370f
commit
1cc780f3ce
4 changed files with 86 additions and 15 deletions
|
@ -70,11 +70,6 @@ RSpec.describe Domain do
|
|||
@domain.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should have correct validity dates' do
|
||||
@domain.outzone_at.should be_nil
|
||||
@domain.delete_at.should be_nil
|
||||
end
|
||||
|
||||
it 'should validate uniqueness of tech contacts' do
|
||||
same_contact = Fabricate(:contact, code: 'same_contact')
|
||||
domain = Fabricate(:domain)
|
||||
|
@ -842,6 +837,26 @@ RSpec.describe Domain do
|
|||
end
|
||||
|
||||
RSpec.describe Domain, db: false do
|
||||
describe '::expire_warning_period', db: true do
|
||||
before :example do
|
||||
Setting.expire_warning_period = 1
|
||||
end
|
||||
|
||||
it 'returns expire warning period' do
|
||||
expect(described_class.expire_warning_period).to eq(1.day)
|
||||
end
|
||||
end
|
||||
|
||||
describe '::redemption_grace_period', db: true do
|
||||
before :example do
|
||||
Setting.redemption_grace_period = 1
|
||||
end
|
||||
|
||||
it 'returns redemption grace period' do
|
||||
expect(described_class.redemption_grace_period).to eq(1.day)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#set_server_hold' do
|
||||
let(:domain) { described_class.new }
|
||||
|
||||
|
@ -858,4 +873,24 @@ RSpec.describe Domain, db: false do
|
|||
expect(domain.outzone_at).to eq(Time.zone.parse('05.07.2010'))
|
||||
end
|
||||
end
|
||||
|
||||
describe '#set_graceful_expired' do
|
||||
let(:domain) { described_class.new }
|
||||
|
||||
before :example do
|
||||
expect(described_class).to receive(:expire_warning_period).and_return(1.day)
|
||||
expect(described_class).to receive(:redemption_grace_period).and_return(2.days)
|
||||
expect(domain).to receive(:valid_to).and_return(Time.zone.parse('05.07.2010 10:30'))
|
||||
|
||||
domain.set_graceful_expired
|
||||
end
|
||||
|
||||
it 'sets :outzone_at to :valid_to + expire warning period' do
|
||||
expect(domain.outzone_at).to eq(Time.zone.parse('06.07.2010 10:30'))
|
||||
end
|
||||
|
||||
it 'sets :delete_at to :outzone_at + redemption grace period' do
|
||||
expect(domain.delete_at).to eq(Time.zone.parse('08.07.2010 10:30'))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue