Sha256: cece06e68a88ba6948bd11a326f25469933f52ee35d29cd76a4d0395f0ca7a78

Contents?: true

Size: 1.14 KB

Versions: 18

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

FactoryBot.define do
  sequence :nhs_number do |n|
    %w(
      6393739592
      4414733227
      5552737601
      4696133478
      4904230000
      5477425407
      7465613493
      9827026836
      2132173117
      2717073604
      3477113764
      7114008236
      9660350961
      2637392835
      1833834704
      9707196408
      0676304567
      0558366333
      1573555126
      5543098111
    )[n]
  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

18 entries across 18 versions & 1 rubygems

Version Path
renalware-core-2.1.1 spec/factories/patients/patients.rb
renalware-core-2.1.0 spec/factories/patients/patients.rb
renalware-core-2.0.167 spec/factories/patients/patients.rb
renalware-core-2.0.166 spec/factories/patients/patients.rb
renalware-core-2.0.165 spec/factories/patients/patients.rb
renalware-core-2.0.164 spec/factories/patients/patients.rb
renalware-core-2.0.163 spec/factories/patients/patients.rb
renalware-core-2.0.162 spec/factories/patients/patients.rb
renalware-core-2.0.161 spec/factories/patients/patients.rb
renalware-core-2.0.160 spec/factories/patients/patients.rb
renalware-core-2.0.159 spec/factories/patients/patients.rb
renalware-core-2.0.158 spec/factories/patients/patients.rb
renalware-core-2.0.157 spec/factories/patients/patients.rb
renalware-core-2.0.156 spec/factories/patients/patients.rb
renalware-core-2.0.155 spec/factories/patients/patients.rb
renalware-core-2.0.153 spec/factories/patients/patients.rb
renalware-core-2.0.152 spec/factories/patients/patients.rb
renalware-core-2.0.151 spec/factories/patients/patients.rb