mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Consider domains having current time at "expire_time" attribute expired
Fixes #238
This commit is contained in:
parent
aa29c781f6
commit
877e6999dc
2 changed files with 4 additions and 4 deletions
|
@ -7,7 +7,7 @@ module Concerns::Domain::Expirable
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
def expired
|
def expired
|
||||||
where("#{attribute_alias(:expire_time)} < ?", Time.zone.now)
|
where("#{attribute_alias(:expire_time)} <= ?", Time.zone.now)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ module Concerns::Domain::Expirable
|
||||||
end
|
end
|
||||||
|
|
||||||
def expired?
|
def expired?
|
||||||
expire_time.past?
|
expire_time <= Time.zone.now
|
||||||
end
|
end
|
||||||
|
|
||||||
def expirable?
|
def expirable?
|
||||||
|
|
|
@ -15,7 +15,7 @@ RSpec.describe Domain, db: false do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns expired domains' do
|
it 'returns expired domains' do
|
||||||
expect(described_class.expired.ids).to eq([1])
|
expect(described_class.expired.ids).to eq([1, 2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ RSpec.describe Domain, db: false do
|
||||||
context 'when :expire_time is now' do
|
context 'when :expire_time is now' do
|
||||||
let(:domain) { described_class.new(expire_time: Time.zone.parse('05.07.2010 00:00')) }
|
let(:domain) { described_class.new(expire_time: Time.zone.parse('05.07.2010 00:00')) }
|
||||||
|
|
||||||
specify { expect(domain).to_not be_expired }
|
specify { expect(domain).to be_expired }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when :expire_time is in the future' do
|
context 'when :expire_time is in the future' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue