2013-07-14 02:49:40 +02:00
|
|
|
require 'factory_girl'
|
|
|
|
|
|
|
|
FactoryGirl.define do
|
|
|
|
|
|
|
|
factory :supplier do
|
2013-07-15 17:57:20 +02:00
|
|
|
name { Faker::Company.name.truncate(30) }
|
2013-07-14 02:49:40 +02:00
|
|
|
phone { Faker::PhoneNumber.phone_number }
|
|
|
|
address { Faker::Address.street_address }
|
|
|
|
|
|
|
|
ignore do
|
|
|
|
article_count 0
|
|
|
|
end
|
|
|
|
|
|
|
|
after :create do |supplier, evaluator|
|
2013-07-15 00:17:07 +02:00
|
|
|
article_count = evaluator.article_count
|
2013-07-25 13:21:24 +02:00
|
|
|
article_count = rand(1..99) if article_count == true
|
2013-09-18 12:44:41 +02:00
|
|
|
create_list :article, article_count, supplier: supplier
|
2013-07-14 02:49:40 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|