Adopt Rails 5 belongs_to_required_by_default
This commit is contained in:
parent
2557645f4f
commit
44a198c7bc
23 changed files with 53 additions and 38 deletions
|
|
@ -11,6 +11,12 @@ FactoryBot.define do
|
|||
article_count { 0 }
|
||||
end
|
||||
|
||||
before :create do |supplier, evaluator|
|
||||
next if supplier.class == SharedSupplier
|
||||
next if supplier.supplier_category_id?
|
||||
supplier.supplier_category = create :supplier_category
|
||||
end
|
||||
|
||||
after :create do |supplier, evaluator|
|
||||
article_count = evaluator.article_count
|
||||
article_count = rand(1..99) if article_count == true
|
||||
|
|
@ -20,4 +26,9 @@ FactoryBot.define do
|
|||
factory :shared_supplier, class: SharedSupplier
|
||||
end
|
||||
|
||||
factory :supplier_category do
|
||||
sequence(:name) { |n| Faker::Lorem.characters(number: rand(2..12)) + " ##{n}" }
|
||||
financial_transaction_class
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue