Sha256: 171565674717ea2b7a3822b1407625fe1e41a82db620c0f41e745b5bdb6ce3c0

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

describe Medivo::PdfGroup do

  it "#variable_fields" do
    name = "Duderoni"
    path = "#{ENGINE_PATH}/spec/fixtures/negative_results.pdf"
    pdf = Medivo::PdfGroup.create do |pdf|
      pdf.variable_fields(path, {:patient_name=>name})
    end
    text = pdf_to_text(pdf.read)
    text.should =~ /#{name}/
  end

  it "#lab_requisition" do
    reqiuisition_number = 170420
    order = Medivo::Order.new(:requisition_number=> reqiuisition_number)
    stub_request(:get, "test:test@test.medivo.com/customers/#{order.requisition_id}.xml?include=requisition").
            to_return(:body => File.read("#{ENGINE_PATH}/spec/fixtures/lc_order_with_requisition.xml"))

    pdf = Medivo::PdfGroup.create do |pdf|
      pdf.lab_requisition(reqiuisition_number)
    end

    text = pdf_to_text(pdf.read)
    text.should match /Account #:111111111 Req\/Control #:170420/
  end

  it "#lab_result" do
    reqiuisition_number = 170420
    order = Medivo::Order.new(:requisition_number=>reqiuisition_number)
    stub_request(:get, "test:test@test.medivo.com/customers/#{order.requisition_id}.xml?include=reconciled_results").
            to_return(:body => File.read(("#{ENGINE_PATH}/spec/fixtures/lc_order_with_positive_results.xml")))

    pdf = Medivo::PdfGroup.create do |pdf|
      pdf.lab_result(reqiuisition_number)
    end

    text = pdf_to_text(pdf.read)
    text.should match /COLLECTED:2011-09-06 RECEIVED:2011-09-06 REPORTED:2011-09-06/
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
medivo-0.1.5 spec/lib/pdf_group_spec.rb
medivo-0.1.4 spec/lib/pdf_group_spec.rb