Sha256: 012fa9922853b7fb07345f64d735b4357ac93ef842228cb7ed2f5e81b1a75857

Contents?: true

Size: 988 Bytes

Versions: 1

Compression:

Stored size: 988 Bytes

Contents

require 'spec_helper'

describe PdftkForms::Fdf do
  context "multiple fields" do
    before do
      @fdf = PdftkForms::Fdf.new :field1 => 'fieldvalue1', :other_field => 'some other value'
      @fdf_text = @fdf.to_fdf
    end
    
    it { @fdf_text.should_not be_nil }
    it { @fdf_text.should match(%r{<</T\(field1\)/V\(fieldvalue1\)>>}) }
    it { @fdf_text.should match(%r{<</T\(other_field\)/V\(some other value\)>>}) }
  end
  
  context "quoting fields" do
    before do
      @fdf = PdftkForms::Fdf.new :field1 => 'field(va)lue1'
      @fdf_text = @fdf.to_fdf
    end
    
    it { @fdf_text.should_not be_nil }
    it { @fdf_text.should match(%r{<</T\(field1\)/V\(field\\\(va\\\)lue1\)>>}) }
  end
  
  context "multi-value fields" do
    before do
      @fdf = PdftkForms::Fdf.new :field1 => %w(one two)
      @fdf_text = @fdf.to_fdf
    end
    
    it { @fdf_text.should_not be_nil }
    it { @fdf_text.should match(%r{<</T\(field1\)/V\[\(one\)\(two\)\]>>}) }
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pdftk_forms-0.1.0 spec/pdftk_forms/fdf_spec.rb