Sha256: c4f054da240fcdf0fffe01b1c7b3aa6bc3c4d3c6bce54d4aea81e4a200bba32d

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require File.dirname(__FILE__) + '/../integration_helper'

describe 'a PDF with a radio field' do
  let(:input_pdf) { File.join(File.dirname(__FILE__), "pdf") }

  context 'with nothing filled in' do
    let(:template) {
      PDFRavager::Template.new
    }
    let(:expected) { File.join(File.dirname(__FILE__), "empty.png") }

    it 'matches empty.png when rendered' do
      pix_diff, _ = compare_pdf_to_png(ravage_to_temp_file(template, input_pdf), expected)
      expect(pix_diff).to eq(0)
    end
  end

  context 'with "Yes" filled in' do
    let(:template) {
      PDFRavager::Template.new do |t|
        t.fill 'RadioButtonList', 'Yes'
      end
    }
    let(:expected) { File.join(File.dirname(__FILE__), "yes.png") }

    it 'matches yes.png when rendered' do
      pix_diff, _ = compare_pdf_to_png(ravage_to_temp_file(template, input_pdf), expected)
      expect(pix_diff).to eq(0)
    end
  end

  context 'with "No" filled in' do
    let(:template) {
      PDFRavager::Template.new do |t|
        t.fill 'RadioButtonList', 'No'
      end
    }
    let(:expected) { File.join(File.dirname(__FILE__), "no.png") }

    it 'matches no.png when rendered' do
      pix_diff, _ = compare_pdf_to_png(ravage_to_temp_file(template, input_pdf), expected)
      expect(pix_diff).to eq(0)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pdf_ravager-0.2.2 spec/integration/radio_field/spec.rb
pdf_ravager-0.2.1 spec/integration/radio_field/spec.rb
pdf_ravager-0.2.0 spec/integration/radio_field/spec.rb