2018-12-09 22:32:35 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
2019-03-25 20:53:57 -04:00
|
|
|
factory :initial_person, class: Person do
|
2019-07-20 05:53:51 -04:00
|
|
|
transient do
|
|
|
|
regional_office { create :regional_office }
|
|
|
|
end
|
|
|
|
|
2019-07-29 01:36:39 -04:00
|
|
|
association :contact_list, factory: :empty_contact_list
|
2019-06-26 20:45:16 -04:00
|
|
|
|
2019-03-25 20:53:57 -04:00
|
|
|
first_name { Faker::Name.first_name }
|
|
|
|
middle_name { Faker::Name.first_name }
|
|
|
|
last_name { Faker::Name.last_name }
|
2019-03-26 16:09:10 -04:00
|
|
|
sex { Person.sexes.keys.sample }
|
|
|
|
date_of_birth { Faker::Date.backward }
|
|
|
|
place_of_birth { Faker::Address.city }
|
2019-03-25 20:53:57 -04:00
|
|
|
end
|
2018-12-15 01:01:00 -05:00
|
|
|
|
2019-07-20 05:53:51 -04: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
|
|
|
|
|
|
|
|
factory :member_person, parent: :supporter_person do
|
|
|
|
after :create do |person, evaluator|
|
|
|
|
create :member_relationship,
|
|
|
|
person: person,
|
|
|
|
regional_office: evaluator.regional_office
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :excluded_person, parent: :member_person do
|
|
|
|
after :create do |person, evaluator|
|
2019-07-26 00:07:18 -04:00
|
|
|
create :excluded_relationship,
|
2019-07-20 05:53:51 -04:00
|
|
|
person: person,
|
|
|
|
regional_office: evaluator.regional_office
|
|
|
|
end
|
|
|
|
end
|
2018-12-09 22:32:35 -05:00
|
|
|
end
|