module WatchDoge::Regression::Utils

Public Class Methods

load_png(input) click to toggle source
# File lib/watchdoge/regression/utils.rb, line 9
def load_png input
  raise 'Invalid Input' unless input.respond_to? :length

  png_magic = ["89", "50", "4E", "47"]

  is_png_blob =
    (input.length > 3 && input[0..3].each_byte.map {|t| t.to_s(16).upcase} == png_magic)

  if is_png_blob
    ChunkyPNG::Image.from_blob input
  else
    ChunkyPNG::Image.from_file input
  end
end
path_to_filename(path) click to toggle source
# File lib/watchdoge/regression/utils.rb, line 24
def path_to_filename path
  path.gsub(/\//, '_')
end
reference_dir() click to toggle source
# File lib/watchdoge/regression/utils.rb, line 36
def reference_dir
  "#{regression_dir}/reference"
end
regression_dir() click to toggle source
# File lib/watchdoge/regression/utils.rb, line 28
def regression_dir
  WatchDoge.configuration.regression_dir
end
scenarios_dir() click to toggle source
# File lib/watchdoge/regression/utils.rb, line 32
def scenarios_dir
  "#{regression_dir}/scenarios"
end