Sha256: 1d7f0201b9955f5567d494db739fe80f59160d52d4042f3adcc168dfbe586c36

Contents?: true

Size: 822 Bytes

Versions: 40

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

FactoryBot.define do
  sequence :nhs_number do |n|
    n.to_s.rjust(10, "0000000000")
  end

  sequence :local_patient_id do |n|
    n.to_s.rjust(6, "Z99999")
  end

  factory :patient, class: "Renalware::Patient" do
    accountable
    nhs_number
    secure_id { SecureRandom.base58(24) }
    local_patient_id
    family_name "Jones"
    given_name "Jack"
    born_on "01/01/1988"
    paediatric_patient_indicator "0"
    sex "M"
    died_on nil
    first_cause_id nil

    # ensures addressable_type and addressable_id work is assigned, using
    # FactoryBot's simple assoc method does not work
    #
    before(:create) do |patient|
      patient.build_current_address(attributes_for(:address))
    end

    trait :with_ethnicity do
      ethnicity factory: :ethnicity
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
renalware-core-2.0.42 spec/factories/patients/patients.rb
renalware-core-2.0.41 spec/factories/patients/patients.rb
renalware-core-2.0.40 spec/factories/patients/patients.rb
renalware-core-2.0.39 spec/factories/patients/patients.rb
renalware-core-2.0.38 spec/factories/patients/patients.rb
renalware-core-2.0.37 spec/factories/patients/patients.rb
renalware-core-2.0.36 spec/factories/patients/patients.rb
renalware-core-2.0.35 spec/factories/patients/patients.rb
renalware-core-2.0.34 spec/factories/patients/patients.rb
renalware-core-2.0.33 spec/factories/patients/patients.rb
renalware-core-2.0.32 spec/factories/patients/patients.rb
renalware-core-2.0.31 spec/factories/patients/patients.rb
renalware-core-2.0.30 spec/factories/patients/patients.rb
renalware-core-2.0.28 spec/factories/patients/patients.rb
renalware-core-2.0.27 spec/factories/patients/patients.rb
renalware-core-2.0.26 spec/factories/patients/patients.rb
renalware-core-2.0.25 spec/factories/patients/patients.rb
renalware-core-2.0.24 spec/factories/patients/patients.rb
renalware-core-2.0.23 spec/factories/patients/patients.rb
renalware-core-2.0.22 spec/factories/patients/patients.rb