Sha256: f50232041dae960b20a254c37cd1f2e7c2762a1dec7cc75426f1579716e48267

Contents?: true

Size: 966 Bytes

Versions: 23

Compression:

Stored size: 966 Bytes

Contents

require 'open-uri'
require 'fileutils'

module PopplerTestUtils
  def ensure_dir(dir)
    FileUtils.mkdir_p(dir)
    dir
  end

  def test_dir
    File.expand_path(File.dirname(__FILE__))
  end

  def fixtures_dir
    ensure_dir(File.join(test_dir, "fixtures"))
  end

  def tmp_dir
    ensure_dir(File.join(test_dir, "tmp"))
  end

  def form_pdf
    file = File.join(fixtures_dir, "form.pdf")
    return file if File.exist?(file)
    pdf = open("http://www.irs.gov/pub/irs-pdf/fw9.pdf").read
    File.open(file, "wb") do |output|
      output.print(pdf)
    end
    file
  end

  def image_pdf
    File.join(fixtures_dir, "image.pdf")
  end

  def later_version?(major, minor, micro=nil)
    micro ||= 0
    (Poppler::BUILD_VERSION <=> [major, minor, micro]) >= 0
  end

  def only_poppler_version(major, minor, micro=nil)
    micro ||= 0
    unless later_version?(major, minor, micro)
      omit("Require Poppler >= #{major}.#{minor}.#{micro}")
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
poppler-0.90.8-x86-mingw32 test/poppler-test-utils.rb
poppler-0.90.8 test/poppler-test-utils.rb
poppler-0.90.7-x86-mingw32 test/poppler-test-utils.rb
poppler-0.90.7 test/poppler-test-utils.rb
poppler-0.90.6-x86-mingw32 test/poppler-test-utils.rb
poppler-0.90.6 test/poppler-test-utils.rb
poppler-0.90.5 test/poppler-test-utils.rb
poppler-0.90.5-x86-mingw32 test/poppler-test-utils.rb
poppler-0.90.4 test/poppler-test-utils.rb
poppler-0.90.4-x86-mingw32 test/poppler-test-utils.rb
poppler-0.90.3 test/poppler-test-utils.rb
poppler-0.90.3-x86-mingw32 test/poppler-test-utils.rb
poppler-0.90.2.3-x86-mingw32 test/poppler-test-utils.rb
poppler-0.90.2.3 test/poppler-test-utils.rb
poppler-0.90.2.2-x86-mingw32 test/poppler-test-utils.rb
poppler-0.90.2.2 test/poppler-test-utils.rb
poppler-0.90.2.1-x86-mingw32 test/poppler-test-utils.rb
poppler-0.90.2.1 test/poppler-test-utils.rb
poppler-0.90.2 test/poppler-test-utils.rb
poppler-0.90.2-x86-mingw32 test/poppler-test-utils.rb