Sha256: 2bee3f6fedc7220bbb62541ed670ea30e21826e5d65a3f371e13107dc5395e58

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 KB

Contents

require 'rubygems'
require 'bundler/setup'
require 'chunky_png'

module PNGSuite

  def png_suite_file(kind, file)
    File.join(png_suite_dir(kind), file)
  end

  def png_suite_dir(kind)
    File.expand_path("./png_suite/#{kind}", File.dirname(__FILE__))
  end

  def png_suite_files(kind, pattern = '*.png')
    Dir[File.join(png_suite_dir(kind), pattern)]
  end
end


module ResourceFileHelper

  def resource_file(name)
    File.expand_path("./resources/#{name}", File.dirname(__FILE__))
  end

  def resource_data(name)
    data = nil
    File.open(resource_file(name), 'rb') { |f| data = f.read }
    data
  end

  def reference_canvas(name)
    ChunkyPNG::Canvas.from_file(resource_file("#{name}.png"))
  end

  def reference_image(name)
    ChunkyPNG::Image.from_file(resource_file("#{name}.png"))
  end

  def display(png)
    filename = resource_file('_tmp.png')
    png.save(filename)
    `open #{filename}`
  end
end

RSpec.configure do |config|
  config.extend PNGSuite
  config.include PNGSuite
  config.include ResourceFileHelper

  config.expect_with :rspec do |c|
    c.syntax = [:should, :expect]
  end
end

Version data entries

9 entries across 8 versions & 3 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/chunky_png-1.3.8/spec/spec_helper.rb
arcabouco-0.2.13 vendor/bundle/gems/chunky_png-1.3.6/spec/spec_helper.rb
chunky_png-1.3.8 spec/spec_helper.rb
second_step-0.1.2 secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/gems/2.2.0/gems/chunky_png-1.3.7/spec/spec_helper.rb
chunky_png-1.3.7 spec/spec_helper.rb
chunky_png-1.3.6 spec/spec_helper.rb
chunky_png-1.3.5 spec/spec_helper.rb
chunky_png-1.3.4 spec/spec_helper.rb
chunky_png-1.3.3 spec/spec_helper.rb