Sha256: 3f2bd44d84c38cb3c0e239c6cad06785cf1ab86de9222e86349121c4d8225f4f

Contents?: true

Size: 895 Bytes

Versions: 3

Compression:

Stored size: 895 Bytes

Contents

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

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

  context 'unchecked' do
    let(:template) {
      PDFRavager::Template.new
    }
    let(:expected) { File.join(File.dirname(__FILE__), "unchecked.png") }

    it 'matches unchecked.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 'checked' do
    let(:template) {
      PDFRavager::Template.new do |t|
        t.check 'CheckBox1'
      end
    }
    let(:expected) { File.join(File.dirname(__FILE__), "checked.png") }

    it 'matches checked.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/checkbox_field/spec.rb
pdf_ravager-0.2.1 spec/integration/checkbox_field/spec.rb
pdf_ravager-0.2.0 spec/integration/checkbox_field/spec.rb