Sha256: 1a0f25b375202ff2fd5b204dc39996118ddbe3cf4b03c5844ccd03d1484996fa

Contents?: true

Size: 1.35 KB

Versions: 118

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

118 entries across 118 versions & 1 rubygems

Version Path
renalware-core-2.0.147 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.146 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.145 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.144 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.143 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.142 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.141 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.140 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.139 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.138 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.137 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.136 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.135 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.134 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.133 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.132 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.131 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.130 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.129 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.128 spec/factories/pathology/observation_requests.rb