diff --git a/spec/factories/order.rb b/spec/factories/order.rb index 27af29d6..f3bf1bde 100644 --- a/spec/factories/order.rb +++ b/spec/factories/order.rb @@ -24,4 +24,8 @@ FactoryGirl.define do end end + # requires order and article + factory :order_article do + end + end diff --git a/spec/factories/supplier.rb b/spec/factories/supplier.rb index fdb2fa03..e4a1c18b 100644 --- a/spec/factories/supplier.rb +++ b/spec/factories/supplier.rb @@ -13,7 +13,7 @@ FactoryGirl.define do after :create do |supplier, evaluator| article_count = evaluator.article_count - article_count = rand(1..100) if article_count == true + article_count = rand(1..99) if article_count == true FactoryGirl.create_list :article, article_count, supplier: supplier end end diff --git a/spec/models/group_order_article_spec.rb b/spec/models/group_order_article_spec.rb index 759e2afc..160b312f 100644 --- a/spec/models/group_order_article_spec.rb +++ b/spec/models/group_order_article_spec.rb @@ -24,20 +24,20 @@ describe GroupOrderArticle do end it 'can be ordered in larger amounts' do - quantity, tolerance = rand(13..100), rand(0..100) + quantity, tolerance = rand(13..99), rand(0..99) goa.update_quantities(quantity, tolerance) expect(goa.quantity).to eq(quantity) expect(goa.tolerance).to eq(tolerance) end it 'has a proper total price' do - quantity = rand(1..100) + quantity = rand(1..99) goa.update_quantities(quantity, 0) expect(goa.total_price).to eq(quantity * goa.order_article.price.fc_price) end it 'can unorder a product' do - goa.update_quantities(rand(1..100), rand(0..100)) + goa.update_quantities(rand(1..99), rand(0..99)) goa.update_quantities(0, 0) expect(goa.quantity).to eq(0) expect(goa.tolerance).to eq(0)