Sha256: 66624f628a2ba21e9879515fdd3cc961fce56e8d5b11309a96bf9e0f93d39b1c

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

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

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

  context 'nothing checked' 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 'CheckBoxGroup.foo checked' do
    let(:template) {
      PDFRavager::Template.new do |t|
        t.checkbox_group 'CheckBoxGroup' do |g|
          g.check 'foo'
        end
      end
    }
    let(:expected) { File.join(File.dirname(__FILE__), "foo.png") }

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

    it 'matches bar.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_group/spec.rb
pdf_ravager-0.2.1 spec/integration/checkbox_group/spec.rb
pdf_ravager-0.2.0 spec/integration/checkbox_group/spec.rb