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/people.rb

83 lines
2.4 KiB
Ruby
Raw Normal View History

2018-12-09 22:32:35 -05:00
# frozen_string_literal: true
FactoryBot.define do
factory :initial_person, class: Person do
transient do
regional_office { create :regional_office }
end
association :contact_list, factory: :empty_contact_list
2019-06-26 20:45:16 -04:00
first_name { Faker::Name.first_name }
middle_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
sex { Person.sexes.keys.sample }
date_of_birth { Faker::Date.backward }
place_of_birth { Faker::Address.city }
end
2018-12-15 01:01:00 -05:00
factory :supporter_person, parent: :initial_person do
after :create do |person, evaluator|
create :supporter_relationship,
person: person,
regional_office: evaluator.regional_office
end
end
2019-08-15 00:00:29 -04:00
factory :member_person, parent: :initial_person do
after :create do |person, evaluator|
create :member_relationship,
person: person,
regional_office: evaluator.regional_office
end
end
2019-08-15 00:00:29 -04:00
factory :excluded_person, parent: :initial_person do
after :create do |person, evaluator|
2019-07-26 00:07:18 -04:00
create :excluded_relationship,
person: person,
regional_office: evaluator.regional_office
end
end
2019-08-14 23:58:02 -04:00
factory :federal_manager_person, parent: :initial_person do
after :create do |person, evaluator|
create :federal_manager_relationship,
person: person,
regional_office: evaluator.regional_office
end
end
2019-08-15 00:25:29 -04:00
factory :federal_supervisor_person, parent: :initial_person do
after :create do |person, evaluator|
create :federal_supervisor_relationship,
person: person,
regional_office: evaluator.regional_office
end
end
factory :regional_manager_person, parent: :initial_person do
after :create do |person, evaluator|
create :regional_manager_relationship,
person: person,
regional_office: evaluator.regional_office
end
end
factory :regional_supervisor_person, parent: :initial_person do
after :create do |person, evaluator|
create :regional_supervisor_relationship,
person: person,
regional_office: evaluator.regional_office
end
end
factory :regional_secretary_person, parent: :initial_person do
after :create do |person, evaluator|
create :regional_secretary_relationship,
person: person,
regional_office: evaluator.regional_office
end
end
2018-12-09 22:32:35 -05:00
end