Sha256: 2157ae93454a07e71d880c6fd4ceb5184214cb50fc2abf8bc744738d44dd4316

Contents?: true

Size: 924 Bytes

Versions: 1

Compression:

Stored size: 924 Bytes

Contents

require 'rubygems'
require 'bundler'

Bundler.setup

require 'rspec'
require 'chunky_png'
require 'oily_png/oily_png'


module OilyPNG
  class Canvas < ChunkyPNG::Canvas
    extend OilyPNG::PNGDecoding
    include OilyPNG::PNGEncoding
  end
end

module ResourceHelper
  def resource_files
    Dir[File.join(File.dirname(__FILE__), 'resources', '*.png')]
  end
end

module CanvasHelper
  
  def resource_files(pattern = "*.png")
    Dir[File.join(File.dirname(__FILE__), 'resources', pattern)]
  end
  
  def resource_file(name)
    File.join(File.dirname(__FILE__), 'resources', name)
  end
  
  def display(canvas)
    filename = resource_file('_tmp.png')
    canvas.to_datastream.save(filename)
    `open #{filename}`
  end
  
  def reference_canvas(name)
    ChunkyPNG::Canvas.from_file(resource_file("#{name}.png"))
  end
end

RSpec.configure do |config|
  config.extend ResourceHelper
  config.include CanvasHelper
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oily_png-0.3.0 spec/spec_helper.rb