Check correct calculation of fc_price

This commit is contained in:
Patrick Gansterer 2017-10-08 12:24:31 +02:00
parent 2d4891bf1d
commit ca7416f2e7
2 changed files with 3 additions and 7 deletions

View File

@ -4,7 +4,7 @@ FactoryGirl.define do
factory :_article do
unit { Faker::Unit.unit }
price { rand(2600) / 100 }
price { rand(0.1..26.0).round(2) }
tax { [6, 21].sample }
deposit { rand(10) < 8 ? 0 : [0.0, 0.80, 1.20, 12.00].sample }
unit_quantity { rand(5) < 3 ? 1 : rand(1..20) }

View File

@ -21,12 +21,8 @@ describe Article do
expect(article.gross_price).to be >= article.price
end
it 'fc-price >= gross price' do
if article.gross_price > 0
expect(article.fc_price).to be > article.gross_price
else
expect(article.fc_price).to be >= article.gross_price
end
it 'computes the fc price correctly' do
expect(article.fc_price).to eq((article.gross_price * 1.05).round(2))
end
it 'knows when it is deleted' do