parent
026c3a6285
commit
a1682932ac
2 changed files with 10 additions and 4 deletions
|
@ -9,7 +9,7 @@ module PriceCalculation
|
||||||
|
|
||||||
# @return [Number] Price for the foodcoop-member.
|
# @return [Number] Price for the foodcoop-member.
|
||||||
def fc_price
|
def fc_price
|
||||||
add_percent(gross_price, FoodsoftConfig[:price_markup])
|
add_percent(gross_price, FoodsoftConfig[:price_markup].to_i)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -59,10 +59,16 @@ describe Article do
|
||||||
expect(article.gross_price).to be >= article.price
|
expect(article.gross_price).to be >= article.price
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'computes the fc price correctly' do
|
[[nil, 1],
|
||||||
expect(article.fc_price).to eq((article.gross_price * 1.05).round(2))
|
[0, 1],
|
||||||
|
[5, 1.05],
|
||||||
|
[42, 1.42],
|
||||||
|
[100, 2]].each do |price_markup, percent|
|
||||||
|
it "computes the fc price with price_markup #{price_markup} correctly" do
|
||||||
|
FoodsoftConfig.config['price_markup'] = price_markup
|
||||||
|
expect(article.fc_price).to eq((article.gross_price * percent).round(2))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'knows when it is deleted' do
|
it 'knows when it is deleted' do
|
||||||
expect(supplier.deleted?).to be false
|
expect(supplier.deleted?).to be false
|
||||||
supplier.mark_as_deleted
|
supplier.mark_as_deleted
|
||||||
|
|
Loading…
Reference in a new issue