Sha256: 14d68f35bd72a48a0872db7a011fd5046126f990634d44a67bb7de456de9b9e0

Contents?: true

Size: 872 Bytes

Versions: 11

Compression:

Stored size: 872 Bytes

Contents

require 'rubygems'
require 'bundler/setup'
require 'chunky_png'
require 'oily_png/canvas'

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
  
  def oily_reference_canvas(name)
    OilyPNG::Canvas.from_file(resource_file("#{name}.png"))
  end
end

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

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
oily_png-1.2.1 spec/spec_helper.rb
bench9000-0.1 vendor/oily_png/spec/spec_helper.rb
oily_png-1.2.0 spec/spec_helper.rb
oily_png-1.1.2 spec/spec_helper.rb
oily_png-1.1.1 spec/spec_helper.rb
oily_png-1.1.0 spec/spec_helper.rb
oily_png-1.0.3 spec/spec_helper.rb
oily_png-1.0.2 spec/spec_helper.rb
oily_png-1.0.1 spec/spec_helper.rb
oily_png-1.0.0 spec/spec_helper.rb
oily_png-1.0.0.rc2 spec/spec_helper.rb