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