diff --git a/spec/factories/article.rb b/spec/factories/article.rb index d627110f..f3dfb917 100644 --- a/spec/factories/article.rb +++ b/spec/factories/article.rb @@ -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) } diff --git a/spec/models/article_spec.rb b/spec/models/article_spec.rb index d5b758bc..b2a0ef6d 100644 --- a/spec/models/article_spec.rb +++ b/spec/models/article_spec.rb @@ -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