Sha256: b36cf54b1e3090f731e0ab0f854c7e2c811af7bc4283fd8fa15f078ffda1be81

Contents?: true

Size: 1016 Bytes

Versions: 4

Compression:

Stored size: 1016 Bytes

Contents

require 'spec_helper'

describe Medivo::FdfGenerator do
  before(:all) do
    @birth_date = '12/23/1901'
    @fdf = Medivo::FdfGenerator.file({:patient_name=>'jane', :birth_date=>@birth_date , :result_date=> '12/24/1901', :missing=>'dude'})
  end

  it "generate fdf" do
    fdf = open(@fdf.path, 'r:ascii-8bit').read
    fdf.should ==  "%FDF-1.2\r%\xE2\xE3\xCF\xD3\r\n1 0 obj\r<< \r/FDF << /Fields [ << /T (patient_name) /V (jane) /ClrF 2 /ClrFf 1 >> << /T (birth_date) /V (12/23/1901) /ClrF 2 /ClrFf 1 >> << /T (result_date) /V (12/24/1901) /ClrF 2 /ClrFf 1 >> << /T (missing) /V (dude) /ClrF 2 /ClrFf 1 >> ] \r>> \r>> \rendobj\rtrailer\r<<\r/Root 1 0 R \r\r>>\r%%EOF\r\n"
  end

  it "fill in pdf form" do
    pdf_output = `pdftk "#{ENGINE_PATH}/spec/fixtures/negative_results.pdf" fill_form #{@fdf.path} output - flatten`
    text = pdf_to_text(pdf_output)
    text.should =~ /jane/
    text.should =~ Regexp.new(@birth_date)
    text.should =~ Regexp.new('12/24/1901')
    text.should_not =~ /we rock/
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
medivo-0.1.7 spec/lib/fdf_generator_spec.rb
medivo-0.1.6 spec/lib/fdf_generator_spec.rb
medivo-0.1.5 spec/lib/fdf_generator_spec.rb
medivo-0.1.4 spec/lib/fdf_generator_spec.rb