Sha256: 0506af6e8e69599ab17dc102202bb6179ae520e262442df669a437e7e77edf7d

Contents?: true

Size: 1.18 KB

Versions: 29

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module PathologySpecHelper
  def create_descriptions(names)
    names.map { |name| create_observation_description(name) }
  end

  def create_observations(patient,
                          descriptions,
                          observed_at: Time.zone.now,
                          result: 1)
    descriptions.map do |description|
      request = create(:pathology_observation_request, patient: patient, requested_at: observed_at)
      create(:pathology_observation,
             request: request,
             description: description,
             observed_at: observed_at,
             result: result)
    end
  end

  # name and code will be the same
  def create_observation_description(name)
    create(:pathology_observation_description, name: name, code: name)
  end

  def create_patient
    patient = create(:patient)
    Renalware::Pathology.cast_patient(patient)
  end

  def add_descriptions_not_observed_for_patient(*description_names)
    description_names.map { |name| create_observation_description(name) }
  end

  def filter_targeted_descriptions(descriptions)
    descriptions.select { |description| description.name.start_with?("target-") }
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
renalware-core-2.0.75 spec/support/pathology_spec_helper.rb
renalware-core-2.0.74 spec/support/pathology_spec_helper.rb
renalware-core-2.0.73 spec/support/pathology_spec_helper.rb
renalware-core-2.0.72 spec/support/pathology_spec_helper.rb
renalware-core-2.0.71 spec/support/pathology_spec_helper.rb
renalware-core-2.0.70 spec/support/pathology_spec_helper.rb
renalware-core-2.0.69 spec/support/pathology_spec_helper.rb
renalware-core-2.0.68 spec/support/pathology_spec_helper.rb
renalware-core-2.0.67 spec/support/pathology_spec_helper.rb
renalware-core-2.0.64 spec/support/pathology_spec_helper.rb
renalware-core-2.0.63 spec/support/pathology_spec_helper.rb
renalware-core-2.0.62 spec/support/pathology_spec_helper.rb
renalware-core-2.0.61 spec/support/pathology_spec_helper.rb
renalware-core-2.0.60 spec/support/pathology_spec_helper.rb
renalware-core-2.0.58 spec/support/pathology_spec_helper.rb
renalware-core-2.0.57 spec/support/pathology_spec_helper.rb
renalware-core-2.0.56 spec/support/pathology_spec_helper.rb
renalware-core-2.0.55 spec/support/pathology_spec_helper.rb
renalware-core-2.0.54 spec/support/pathology_spec_helper.rb
renalware-core-2.0.53 spec/support/pathology_spec_helper.rb