Sha256: 1d3d22b2bdb13ce4d1bc6be43a07c3ac817ad24dd1795a1d36ac2c808be3ce05

Contents?: true

Size: 879 Bytes

Versions: 50

Compression:

Stored size: 879 Bytes

Contents

FactoryBot.define do
  factory :egov_utils_person, class: 'EgovUtils::Person' do
    transient do
      natural_attributes { Hash.new }
    end
    association :residence, factory: :egov_utils_address
    joid { SecureRandom.uuid }
    person_type { nil }
    natural_person { nil }
    legal_person { nil }

    trait :natural do
      person_type { 'natural' }
      after(:build) do |person, evaluator|
        evaluator.natural_person = FactoryBot.build(:egov_utils_natural_person, evaluator.natural_attributes.merge(person: person))
      end
    end

    factory :natural_person, traits: [:natural]
  end

  factory :egov_utils_natural_person, class: 'EgovUtils::NaturalPerson' do
    firstname { 'John' }
    sequence(:lastname){|n| "Doe-#{n}"}
    birth_date { Date.today - (Random.new.rand(50)+18).years }
    association :person, factory: :egov_utils_person
  end

end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
egov_utils-1.5.0.alpha16 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha15 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha14 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha13 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha12 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha11 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha10 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha9 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha8 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha7 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha6 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha5 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha4 spec/factories/egov_utils_people.rb
egov_utils-1.4.4 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha3 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha2 spec/factories/egov_utils_people.rb
egov_utils-1.5.0.alpha1 spec/factories/egov_utils_people.rb
egov_utils-1.4.3 spec/factories/egov_utils_people.rb
egov_utils-1.4.2 spec/factories/egov_utils_people.rb
egov_utils-1.4.1 spec/factories/egov_utils_people.rb