1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/factories/org_unit_kinds.rb

69 lines
2.1 KiB
Ruby
Raw Normal View History

2019-09-30 12:33:05 -04:00
# frozen_string_literal: true
FactoryBot.define do
factory :some_root_org_unit_kind, class: OrgUnitKind do
codename { Faker::Internet.unique.username 3..36, %w[_] }
short_name { name }
name { Faker::Company.unique.name }
trait :with_parent do
association :parent_kind, factory: :some_root_org_unit_kind
end
end
factory :some_children_org_unit_kind,
parent: :some_root_org_unit_kind,
traits: %i[with_parent]
2019-10-02 08:05:32 -04:00
factory :lpr_org_unit_kind, class: OrgUnitKind do
initialize_with do
OrgUnitKind.find_or_initialize_by codename: codename
end
codename { :lpr }
short_name { 'ЛПР' }
name { 'Либертарианская партия России' }
end
factory :reg_dept_org_unit_kind, parent: :lpr_org_unit_kind do
codename { :reg_dept }
short_name { 'РО' }
name { 'Региональное отделение' }
2019-10-21 02:09:51 -04:00
resource_type { 'FederalSubject' }
2019-10-02 08:05:32 -04:00
association :parent_kind, factory: :lpr_org_unit_kind
end
factory :fed_management_org_unit_kind, parent: :lpr_org_unit_kind do
codename { :fed_management }
short_name { 'ФК' }
name { 'Федеральный комитет' }
association :parent_kind, factory: :lpr_org_unit_kind
end
factory :fed_supervision_org_unit_kind, parent: :lpr_org_unit_kind do
codename { :fed_supervision }
short_name { 'ЦКРК' }
name { 'Центральная контрольно-ревизионная комиссия' }
association :parent_kind, factory: :lpr_org_unit_kind
end
factory :reg_management_org_unit_kind, parent: :lpr_org_unit_kind do
codename { :reg_management }
short_name { 'РК РО' }
name { 'Руководящий комитет регионального отделения' }
association :parent_kind, factory: :reg_dept_org_unit_kind
end
factory :reg_supervision_org_unit_kind, parent: :lpr_org_unit_kind do
codename { :reg_supervision }
short_name { 'РКРК' }
name { 'Региональная контрольно-ревизионная комиссия' }
association :parent_kind, factory: :reg_dept_org_unit_kind
end
2019-09-30 12:33:05 -04:00
end