Sha256: 9ee668222b4af4980c10b9bea38d3672972a862957c2f2be99a02bf6b7313625

Contents?: true

Size: 1.35 KB

Versions: 39

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

FactoryBot.define do
  sequence(:requestor_order_number) { |n| "PlacerID-#{n}" }

  factory :pathology_observation_request, class: "Renalware::Pathology::ObservationRequest" do
    association :description, factory: :pathology_request_description
    requestor_order_number
    requestor_name "Jane Doe"
    requested_at { 1.year.ago }

    trait :full_blood_count_with_observations do
      association :description, factory: :pathology_request_description, code: "FBC"
      after(:create) do |request|
        %w(WBC HGB PLT).each do |obx_code|
          desc = create(:pathology_observation_description, code: obx_code)
          create(
            :pathology_observation,
            description: desc,
            request: request,
            observed_at: request.requested_at
          )
        end
      end
    end

    trait :renal_live_urea_with_observations do
      association :description, factory: :pathology_request_description, code: "RLU"
      after(:create) do |request|
        %w(NA POT URE).each do |obx_code|
          desc = create(:pathology_observation_description, code: obx_code)
          create(
            :pathology_observation,
            description: desc,
            request: request,
            observed_at: request.requested_at,
            result: 1.0
          )
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

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