From cb02ac4c93ff451b74d1b58072e5f030a8d7a4af Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Wed, 10 Jun 2015 15:06:20 +0300 Subject: [PATCH] Fix renew restriction #2610 --- app/models/domain.rb | 2 +- db/schema.rb | 2 +- spec/epp/domain_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 84946b3e1..16d96bb09 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -245,7 +245,7 @@ class Domain < ActiveRecord::Base def renewable? if Setting.days_to_renew_domain_before_expire != 0 - if (valid_to - Time.zone.now).to_i / 1.day >= Setting.days_to_renew_domain_before_expire + if ((valid_to - Time.zone.now).to_i / 1.day) + 1 >= Setting.days_to_renew_domain_before_expire return false end end diff --git a/db/schema.rb b/db/schema.rb index 2f0849424..d395a7557 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150609103333) do +ActiveRecord::Schema.define(version: 20150610112238) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 89e60de00..2b4de33d5 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -1999,7 +1999,7 @@ describe 'EPP Domain', epp: true do end it 'does not renew a domain unless less than 90 days till expiration' do - domain.valid_to = Time.zone.now.to_date + 91.days + domain.valid_to = Time.zone.now.to_date + 90.days domain.save exp_date = domain.valid_to.to_date @@ -2013,7 +2013,7 @@ describe 'EPP Domain', epp: true do response[:results][0][:msg].should == 'Object is not eligible for renewal' response[:results][0][:result_code].should == '2105' - domain.valid_to = Time.zone.now.to_date + 90.days + domain.valid_to = Time.zone.now.to_date + 89.days domain.save exp_date = domain.valid_to.to_date