This commit is contained in:
Martin Lensment 2015-07-06 11:25:05 +03:00
parent b0da030889
commit 1b1794887a

View file

@ -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