expand rspec tests
This commit is contained in:
parent
3c264f6225
commit
acd18721aa
4 changed files with 71 additions and 1 deletions
14
spec/factories/order.rb
Normal file
14
spec/factories/order.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
require 'factory_girl'
|
||||
|
||||
FactoryGirl.define do
|
||||
|
||||
# requires articles from single supplier, or supplier (with all its articles)
|
||||
factory :order do
|
||||
starts { Time.now }
|
||||
|
||||
factory :stock_order do
|
||||
supplier_id 0
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -12,7 +12,9 @@ FactoryGirl.define do
|
|||
end
|
||||
|
||||
after :create do |supplier, evaluator|
|
||||
FactoryGirl.create_list :article, evaluator.article_count, supplier: supplier
|
||||
article_count = evaluator.article_count
|
||||
article_count = rand(1..100) if article_count == true
|
||||
FactoryGirl.create_list :article, article_count, supplier: supplier
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue