Sha256: eba8cda988de01e8f2c43a96dd0a2c2a731b696e5a09461e8ba4433a0f975b55

Contents?: true

Size: 1.15 KB

Versions: 40

Compression:

Stored size: 1.15 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)
      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

40 entries across 40 versions & 1 rubygems

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