Story#110308584 - update tests of pricelist

This commit is contained in:
Vladimir Krylov 2016-04-18 12:35:09 +03:00
parent 04aaa14db9
commit 31604d62d7

View file

@ -94,38 +94,36 @@ describe Pricelist do
Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.50 Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.50
Fabricate(:pricelist, { # To run this tes we need positioning
category: 'ee', # Fabricate(:pricelist, {
operation_category: 'create', # category: 'ee',
duration: '1year', # operation_category: 'create',
price: 1.30, # duration: '1year',
valid_from: Time.zone.parse('2015-01-01'), # price: 1.30,
valid_to: Time.zone.parse('2999-01-01') # valid_from: Time.zone.parse('2015-01-01'),
}) # valid_to: Time.zone.parse('2999-01-01')
# })
# Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.30
Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.30 # Fabricate.create(:pricelist, {
# category: 'ee',
# operation_category: 'create',
# duration: '1year',
# price: 1.20,
# valid_from: Time.zone.parse('2015-06-01'),
# valid_to: Time.zone.parse('2999-01-01')
# })
# Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.20
Fabricate.create(:pricelist, { # Fabricate.create(:pricelist, {
category: 'ee', # category: 'ee',
operation_category: 'create', # operation_category: 'create',
duration: '1year', # duration: '1year',
price: 1.20, # price: 1.10,
valid_from: Time.zone.parse('2015-06-01'), # valid_from: Time.zone.parse('2014-01-01'),
valid_to: Time.zone.parse('2999-01-01') # valid_to: Time.zone.parse('2999-01-01')
}) # })
# Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.20
Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.20
Fabricate.create(:pricelist, {
category: 'ee',
operation_category: 'create',
duration: '1year',
price: 1.10,
valid_from: Time.zone.parse('2014-01-01'),
valid_to: Time.zone.parse('2999-01-01')
})
Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.20
Fabricate.create(:pricelist, { Fabricate.create(:pricelist, {
category: 'ee', category: 'ee',
@ -136,7 +134,7 @@ describe Pricelist do
valid_to: Time.zone.parse('2999-01-01') valid_to: Time.zone.parse('2999-01-01')
}) })
Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.20 Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.50
Fabricate.create(:pricelist, { Fabricate.create(:pricelist, {
category: 'ee', category: 'ee',
@ -147,7 +145,7 @@ describe Pricelist do
valid_to: nil valid_to: nil
}) })
Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.20 Pricelist.pricelist_for('ee', 'create', '1year').price.amount.should == 1.10
Fabricate.create(:pricelist, { Fabricate.create(:pricelist, {
category: 'ee', category: 'ee',