Sha256: 517446a598d16878323293331c1f4708f3c37322dac4045c043d32862f8b15be

Contents?: true

Size: 1.01 KB

Versions: 13

Compression:

Stored size: 1.01 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_fixture_path "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

13 entries across 13 versions & 1 rubygems

Version Path
medivo-0.1.23 spec/lib/fdf_generator_spec.rb
medivo-0.1.22 spec/lib/fdf_generator_spec.rb
medivo-0.1.21 spec/lib/fdf_generator_spec.rb
medivo-0.1.20 spec/lib/fdf_generator_spec.rb
medivo-0.1.19 spec/lib/fdf_generator_spec.rb
medivo-0.1.18 spec/lib/fdf_generator_spec.rb
medivo-0.1.17 spec/lib/fdf_generator_spec.rb
medivo-0.1.16 spec/lib/fdf_generator_spec.rb
medivo-0.1.15 spec/lib/fdf_generator_spec.rb
medivo-0.1.14 spec/lib/fdf_generator_spec.rb
medivo-0.1.13 spec/lib/fdf_generator_spec.rb
medivo-0.1.12 spec/lib/fdf_generator_spec.rb
medivo-0.1.11 spec/lib/fdf_generator_spec.rb