class Crucible::Tests::ConnectathonFinancialTrackTest

Public Class Methods

new(client1, client2=nil) click to toggle source
Calls superclass method Crucible::Tests::BaseTest::new
# File lib/tests/suites/connectathon_financial_track.rb, line 13
def initialize(client1, client2=nil)
  super(client1, client2)
  @tags.append('connectathon')
  @category = {id: 'connectathon', title: 'Connectathon'}
end

Public Instance Methods

description() click to toggle source
# File lib/tests/suites/connectathon_financial_track.rb, line 9
def description
  'Connectathon Financial Track Test focuses on submitting Claims and retreiving ClaimResponses.'
end
id() click to toggle source
# File lib/tests/suites/connectathon_financial_track.rb, line 5
def id
  'ConnectathonFinancialTrackTest'
end
setup() click to toggle source
# File lib/tests/suites/connectathon_financial_track.rb, line 19
def setup
  @resources = Crucible::Generator::Resources.new

  @simple = @resources.simple_claim
  @simple.id = nil # clear the identifier, in case the server checks for duplicates
  @simple.identifier = nil # clear the identifier, in case the server checks for duplicates

  @average = @resources.average_claim
  @average.id = nil # clear the identifier, in case the server checks for duplicates
  @average.identifier = nil # clear the identifier, in case the server checks for duplicates


  @preauth = @resources.complex_claim
  @preauth.id = nil # clear the identifier, in case the server checks for duplicates
  @preauth.identifier = nil # clear the identifier, in case the server checks for duplicates

  @er = @resources.load_fixture('financial/eligibilityrequest-example.xml')
  @er.id = nil
  @er.identifier = nil

  @patient = @resources.minimal_patient
  @patient.id = nil
  @patient.identifier = [FHIR::Identifier.new]
  @patient.identifier[0].value = SecureRandom.urlsafe_base64
  result = @client.create(@patient)
  assert_response_ok(result)
  @patient_id = result.id

  @simple.patient.reference = "Patient/#{@patient_id}"
  @average.patient.reference = "Patient/#{@patient_id}"
  @preauth.patient.reference = "Patient/#{@patient_id}"
  @er.patient.reference = "Patient/#{@patient_id}"

  @organization_1 = @resources.example_patient_record_organization_201
  @organization_1.id = nil
  reply = @client.create @organization_1
  @organization_1_id = reply.id
  @organization_1.id = @organization_1_id
  assert_response_ok(reply)

  @simple.organization.reference = "Organization/#{@organization_1_id}"
  @average.organization.reference = "Organization/#{@organization_1_id}"
  @preauth.organization.reference = "Organization/#{@organization_1_id}"
  @er.organization.reference = "Organization/#{@organization_1_id}"

  @organization_2 = @resources.example_patient_record_organization_203
  @organization_2.id = nil
  reply = @client.create @organization_2
  @organization_2_id = reply.id
  @organization_2.id = @organization_2_id
  assert_response_ok(reply)

  @simple.insurer.reference = "Organization/#{@organization_2_id}"
  @average.insurer.reference = "Organization/#{@organization_2_id}"
  @preauth.insurer.reference = "Organization/#{@organization_2_id}"
  @er.insurer.reference = "Organization/#{@organization_2_id}"
end
teardown() click to toggle source
# File lib/tests/suites/connectathon_financial_track.rb, line 77
def teardown
  @client.destroy(FHIR::Claim, @simple_id) if !@simple_id.nil?
  @client.destroy(FHIR::Claim, @preauth_id) if !@preauth_id.nil?
  @client.destroy(FHIR::Claim, @average_id) if !@average_id.nil?
  @client.destroy(FHIR::ClaimResponse, @simple_response_id) if !@simple_response_id.nil?
  @client.destroy(FHIR::ClaimResponse, @average_response_id) if !@average_response_id.nil?
  @client.destroy(FHIR::ClaimResponse, @preauth_response_id) if !@preauth_response_id.nil?
  @client.destroy(FHIR::Patient, @patient_id) if !@patient_id.nil?
  @client.destroy(FHIR::Patient, @organization_1_id) if !@organization_1_id.nil?
  @client.destroy(FHIR::Patient, @organization_2_id) if !@organization_2_id.nil?
  @client.destroy(FHIR::EligibilityRequest, @er_id) if !@er_id.nil?
  @client.destroy(FHIR::Communication, @preauth_communication_id) if !@preauth_communication_id.nil?
end