Check correct calculation of fc_price
This commit is contained in:
parent
2d4891bf1d
commit
ca7416f2e7
2 changed files with 3 additions and 7 deletions
|
@ -4,7 +4,7 @@ FactoryGirl.define do
|
||||||
|
|
||||||
factory :_article do
|
factory :_article do
|
||||||
unit { Faker::Unit.unit }
|
unit { Faker::Unit.unit }
|
||||||
price { rand(2600) / 100 }
|
price { rand(0.1..26.0).round(2) }
|
||||||
tax { [6, 21].sample }
|
tax { [6, 21].sample }
|
||||||
deposit { rand(10) < 8 ? 0 : [0.0, 0.80, 1.20, 12.00].sample }
|
deposit { rand(10) < 8 ? 0 : [0.0, 0.80, 1.20, 12.00].sample }
|
||||||
unit_quantity { rand(5) < 3 ? 1 : rand(1..20) }
|
unit_quantity { rand(5) < 3 ? 1 : rand(1..20) }
|
||||||
|
|
|
@ -21,12 +21,8 @@ describe Article do
|
||||||
expect(article.gross_price).to be >= article.price
|
expect(article.gross_price).to be >= article.price
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fc-price >= gross price' do
|
it 'computes the fc price correctly' do
|
||||||
if article.gross_price > 0
|
expect(article.fc_price).to eq((article.gross_price * 1.05).round(2))
|
||||||
expect(article.fc_price).to be > article.gross_price
|
|
||||||
else
|
|
||||||
expect(article.fc_price).to be >= article.gross_price
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'knows when it is deleted' do
|
it 'knows when it is deleted' do
|
||||||
|
|
Loading…
Reference in a new issue