This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
2019-09-30 22:20:45 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
|
|
|
factory :some_root_org_unit, class: OrgUnit do
|
2019-09-30 22:32:04 +00:00
|
|
|
short_name { name }
|
2019-09-30 22:20:45 +00:00
|
|
|
name { Faker::Company.unique.name }
|
|
|
|
|
|
|
|
association :kind, factory: :some_root_org_unit_kind
|
|
|
|
|
|
|
|
trait :with_parent do
|
|
|
|
association :kind, factory: :some_children_org_unit_kind
|
|
|
|
|
2019-10-02 01:31:12 +00:00
|
|
|
parent_unit { create :some_root_org_unit, kind: kind.parent_kind }
|
2019-09-30 22:20:45 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :some_children_org_unit,
|
|
|
|
parent: :some_root_org_unit,
|
|
|
|
traits: %i[with_parent]
|
|
|
|
end
|