Sha256: 01d9c6db4726a144da12a4a19e4370fa46b8f61266b5491c6109ed3cbb7b19ba

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

puts "Prawn specs: Running on Ruby Version: #{RUBY_VERSION}"

require 'bundler'
Bundler.setup

if ENV['COVERAGE']
  require 'simplecov'
  SimpleCov.start do
    add_filter '/spec/'
  end
end

require_relative '../lib/prawn'

Prawn.debug = true
Prawn::Font::AFM.hide_m17n_warning = true

require 'rspec'
require 'pdf/reader'
require 'pdf/inspector'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/extensions/ and its subdirectories.
Dir[File.dirname(__FILE__) + '/extensions/**/*.rb'].each { |f| require f }

RSpec.configure do |config|
  config.include EncodingHelpers
end

def create_pdf(klass = Prawn::Document, &block)
  klass.new(margin: 0, &block)
end

RSpec::Matchers.define :have_parseable_xobjects do
  match do |actual|
    expect { PDF::Inspector::XObject.analyze(actual.render) }.to_not raise_error
    true
  end
  failure_message do |actual|
    "expected that #{actual}'s XObjects could be successfully parsed"
  end
end

# Make some methods public to assist in testing
module Prawn
  module Graphics
    public :map_to_absolute
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prawn-2.2.2 spec/spec_helper.rb
prawn-2.2.1 spec/spec_helper.rb
prawn-2.2.0 spec/spec_helper.rb