Sha256: 0a0a5d89770cace77b3150cd8844b179e439f84e696606f35be55510abebddfc

Contents?: true

Size: 1.02 KB

Versions: 19

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe Medivo::FdfGenerator do
  before(:all) do
    @fields = {
            :patient_name=>'jane',
            :birth_date=> '01/29/2000',
            :result_date=> '12/24/1901',
            :missing=>'dude'
    }
    @fdf = Medivo::FdfGenerator.file(@fields)
  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 (01/29/2000) /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_path = medivo_pdf_fixture_path "hepc_negative_results.pdf"
    pdf_output = `pdftk #{pdf_path} fill_form #{@fdf.path} output - flatten`
    text = pdf_stream_to_text(pdf_output)
    @fields.each do |key,value|
      text.should match value unless key == :missing
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
medivo-0.2.24 spec/lib/fdf_generator_spec.rb
medivo-0.2.21 spec/lib/fdf_generator_spec.rb
medivo-0.2.20 spec/lib/fdf_generator_spec.rb
medivo-0.2.19 spec/lib/fdf_generator_spec.rb
medivo-0.2.18 spec/lib/fdf_generator_spec.rb
medivo-0.2.17 spec/lib/fdf_generator_spec.rb
medivo-0.2.16 spec/lib/fdf_generator_spec.rb
medivo-0.2.15 spec/lib/fdf_generator_spec.rb
medivo-0.2.14 spec/lib/fdf_generator_spec.rb
medivo-0.2.13 spec/lib/fdf_generator_spec.rb
medivo-0.2.12 spec/lib/fdf_generator_spec.rb
medivo-0.2.11 spec/lib/fdf_generator_spec.rb
medivo-0.2.10 spec/lib/fdf_generator_spec.rb
medivo-0.2.9 spec/lib/fdf_generator_spec.rb
medivo-0.2.8 spec/lib/fdf_generator_spec.rb
medivo-0.2.7 spec/lib/fdf_generator_spec.rb
medivo-0.2.6 spec/lib/fdf_generator_spec.rb
medivo-0.2.5 spec/lib/fdf_generator_spec.rb
medivo-0.2.3 spec/lib/fdf_generator_spec.rb