Sha256: 2c9ab014548d20cc289846cf696c30b2431a92b6fa826177a82c242938fe7e10
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
# encoding: UTF-8 require 'rspec' require_relative './comparator' module Simulacrum # Custom RSpec matchers module Matchers extend RSpec::Matchers::DSL matcher :look_the_same do match do |component| component = component comparator = Simulacrum::Comparator.new(component) case comparator.test when true true when false fail Simulacrum::Matchers.fail_message(component, comparator) when nil skip Simulacrum::Matchers.pending_message(component) end end end def self.fail_message(component, comparator) <<-eos The pixel change percentage (#{comparator.diff.delta}%) exceeded the maximum \ threshold of #{component.delta_threshold}%. Reference: #{component.reference_path} Candidate: #{component.candidate_path} Diff: #{component.diff_path} eos end def self.pending_message(component) <<-eos No reference image found! Candidate created: #{component.candidate_path} eos end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
simulacrum-0.3.2 | lib/simulacrum/matchers.rb |
simulacrum-0.3.1 | lib/simulacrum/matchers.rb |
simulacrum-0.3.0 | lib/simulacrum/matchers.rb |