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.1.1 spec/factories/pathology/observation_requests.rb
renalware-core-2.1.0 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.167 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.166 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.165 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.164 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.163 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.162 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.161 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.160 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.159 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.158 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.157 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.156 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.155 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.153 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.152 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.151 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.149 spec/factories/pathology/observation_requests.rb
renalware-core-2.0.148 spec/factories/pathology/observation_requests.rb