Sha256: 1207cc6411d2ccb77eb32a573dbd025b019bb4ea89a606496d6f0ed8d09c63bd

Contents?: true

Size: 791 Bytes

Versions: 13

Compression:

Stored size: 791 Bytes

Contents

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

13 entries across 13 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc11 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.rc10 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.rc9 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.rc8 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.rc7 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.rc6 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.rc5 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.rc4 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.rc3 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.rc1 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.beta12 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.beta11 spec/factories/patients/patients.rb
renalware-core-2.0.0.pre.beta10 spec/factories/patients/patients.rb