mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 04:58:29 +02:00
parent
f76e1259fc
commit
f3e790b481
2 changed files with 32 additions and 32 deletions
|
@ -23,27 +23,27 @@ module Billing
|
||||||
|
|
||||||
def self.durations
|
def self.durations
|
||||||
[
|
[
|
||||||
'3 mons',
|
'3 mons',
|
||||||
'6 mons',
|
'6 mons',
|
||||||
'9 mons',
|
'9 mons',
|
||||||
'1 year',
|
'1 year',
|
||||||
'2 years',
|
'2 years',
|
||||||
'3 years',
|
'3 years',
|
||||||
'4 years',
|
'4 years',
|
||||||
'5 years',
|
'5 years',
|
||||||
'6 years',
|
'6 years',
|
||||||
'7 years',
|
'7 years',
|
||||||
'8 years',
|
'8 years',
|
||||||
'9 years',
|
'9 years',
|
||||||
'10 years',
|
'10 years',
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.statuses
|
def self.statuses
|
||||||
%w[pending effective expired]
|
%w[upcoming effective expired]
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.pending
|
def self.upcoming
|
||||||
where("#{attribute_alias(:effect_time)} > ?", Time.zone.now)
|
where("#{attribute_alias(:effect_time)} > ?", Time.zone.now)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,19 +24,19 @@ RSpec.describe Billing::Price do
|
||||||
describe '::durations', db: false do
|
describe '::durations', db: false do
|
||||||
it 'returns durations' do
|
it 'returns durations' do
|
||||||
durations = [
|
durations = [
|
||||||
'3 mons',
|
'3 mons',
|
||||||
'6 mons',
|
'6 mons',
|
||||||
'9 mons',
|
'9 mons',
|
||||||
'1 year',
|
'1 year',
|
||||||
'2 years',
|
'2 years',
|
||||||
'3 years',
|
'3 years',
|
||||||
'4 years',
|
'4 years',
|
||||||
'5 years',
|
'5 years',
|
||||||
'6 years',
|
'6 years',
|
||||||
'7 years',
|
'7 years',
|
||||||
'8 years',
|
'8 years',
|
||||||
'9 years',
|
'9 years',
|
||||||
'10 years',
|
'10 years',
|
||||||
]
|
]
|
||||||
|
|
||||||
expect(described_class.durations).to eq(durations)
|
expect(described_class.durations).to eq(durations)
|
||||||
|
@ -45,11 +45,11 @@ RSpec.describe Billing::Price do
|
||||||
|
|
||||||
describe '::statuses', db: false do
|
describe '::statuses', db: false do
|
||||||
it 'returns statuses' do
|
it 'returns statuses' do
|
||||||
expect(described_class.statuses).to eq(%w[pending effective expired])
|
expect(described_class.statuses).to eq(%w[upcoming effective expired])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '::pending' do
|
describe '::upcoming' do
|
||||||
before :example do
|
before :example do
|
||||||
travel_to Time.zone.parse('05.07.2010 00:00')
|
travel_to Time.zone.parse('05.07.2010 00:00')
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ RSpec.describe Billing::Price do
|
||||||
create(:price, id: 2, effect_time: Time.zone.parse('05.07.2010 00:01'))
|
create(:price, id: 2, effect_time: Time.zone.parse('05.07.2010 00:01'))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns pending' do
|
it 'returns upcoming' do
|
||||||
expect(described_class.pending.ids).to eq([2])
|
expect(described_class.upcoming.ids).to eq([2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue