mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
Add tests #2741
This commit is contained in:
parent
b0da030889
commit
1b1794887a
1 changed files with 93 additions and 1 deletions
|
@ -182,7 +182,7 @@ describe Domain do
|
|||
@domain.force_delete_at.should be_nil
|
||||
end
|
||||
|
||||
it 'should know its price' do
|
||||
it 'should know its create price' do
|
||||
Fabricate(:pricelist, {
|
||||
category: 'ee',
|
||||
operation_category: 'create',
|
||||
|
@ -200,6 +200,98 @@ describe Domain do
|
|||
|
||||
domain = Fabricate(:domain, period: 365, period_unit: 'd')
|
||||
domain.price('create').should == 1.50
|
||||
|
||||
Fabricate(:pricelist, {
|
||||
category: 'ee',
|
||||
operation_category: 'create',
|
||||
duration: '2years',
|
||||
price: 3,
|
||||
valid_from: Time.zone.parse('2015-01-01'),
|
||||
valid_to: nil
|
||||
})
|
||||
|
||||
domain = Fabricate(:domain, period: 2)
|
||||
domain.price('create').should == 3.0
|
||||
|
||||
domain = Fabricate(:domain, period: 24, period_unit: 'm')
|
||||
domain.price('create').should == 3.0
|
||||
|
||||
domain = Fabricate(:domain, period: 730, period_unit: 'd')
|
||||
domain.price('create').should == 3.0
|
||||
|
||||
Fabricate(:pricelist, {
|
||||
category: 'ee',
|
||||
operation_category: 'create',
|
||||
duration: '3years',
|
||||
price: 6,
|
||||
valid_from: Time.zone.parse('2015-01-01'),
|
||||
valid_to: nil
|
||||
})
|
||||
|
||||
domain = Fabricate(:domain, period: 3)
|
||||
domain.price('create').should == 6.0
|
||||
|
||||
domain = Fabricate(:domain, period: 36, period_unit: 'm')
|
||||
domain.price('create').should == 6.0
|
||||
|
||||
domain = Fabricate(:domain, period: 1095, period_unit: 'd')
|
||||
domain.price('create').should == 6.0
|
||||
end
|
||||
|
||||
it 'should know its renew price' do
|
||||
Fabricate(:pricelist, {
|
||||
category: 'ee',
|
||||
operation_category: 'renew',
|
||||
duration: '1year',
|
||||
price: 1.30,
|
||||
valid_from: Time.zone.parse('2015-01-01'),
|
||||
valid_to: nil
|
||||
})
|
||||
|
||||
domain = Fabricate(:domain)
|
||||
domain.price('renew').should == 1.30
|
||||
|
||||
domain = Fabricate(:domain, period: 12, period_unit: 'm')
|
||||
domain.price('renew').should == 1.30
|
||||
|
||||
domain = Fabricate(:domain, period: 365, period_unit: 'd')
|
||||
domain.price('renew').should == 1.30
|
||||
|
||||
Fabricate(:pricelist, {
|
||||
category: 'ee',
|
||||
operation_category: 'renew',
|
||||
duration: '2years',
|
||||
price: 3.1,
|
||||
valid_from: Time.zone.parse('2015-01-01'),
|
||||
valid_to: nil
|
||||
})
|
||||
|
||||
domain = Fabricate(:domain, period: 2)
|
||||
domain.price('renew').should == 3.1
|
||||
|
||||
domain = Fabricate(:domain, period: 24, period_unit: 'm')
|
||||
domain.price('renew').should == 3.1
|
||||
|
||||
domain = Fabricate(:domain, period: 730, period_unit: 'd')
|
||||
domain.price('renew').should == 3.1
|
||||
|
||||
Fabricate(:pricelist, {
|
||||
category: 'ee',
|
||||
operation_category: 'renew',
|
||||
duration: '3years',
|
||||
price: 6.1,
|
||||
valid_from: Time.zone.parse('2015-01-01'),
|
||||
valid_to: nil
|
||||
})
|
||||
|
||||
domain = Fabricate(:domain, period: 3)
|
||||
domain.price('renew').should == 6.1
|
||||
|
||||
domain = Fabricate(:domain, period: 36, period_unit: 'm')
|
||||
domain.price('renew').should == 6.1
|
||||
|
||||
domain = Fabricate(:domain, period: 1095, period_unit: 'd')
|
||||
domain.price('renew').should == 6.1
|
||||
end
|
||||
|
||||
context 'about registrant update confirm' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue