Sha256: 26e8080e9b04ee570fbfb1e6c25cfd4f356c8a7a3b0ec46d5614793e906ea9d2

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

require 'minitest/autorun'
require 'minitest/spec'
require 'minitest/unit'
require 'mocha/minitest'
require 'pdf/inspector'

require 'digest/sha1'
require 'pathname'
require 'thinreports'

require 'schema_helper'

module Thinreports::TestHelper
  ROOT = Pathname.new(File.expand_path('..', __FILE__))

  include Thinreports::SchemaHelper

  def assert_deprecated(&block)
    _out, err = capture_io { block.call }
    assert err.to_s.include?('[DEPRECATION]')
  end

  def data_file(*paths)
    ROOT.join('data', *paths).to_s
  end

  def read_data_file(*paths)
    File.read(data_file(*paths))
  end

  def analyze_pdf_images(pdf_data)
    analyzer = PDF::Inspector::XObject.analyze(pdf_data)
    analyzer.page_xobjects
      .reduce(:merge).values
      .select { |o| o.hash[:Subtype] == :Image }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.10.3 test/test_helper.rb