class Capybara::Screenshot::Diff::Difference

Public Instance Methods

area_size_limit() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 33
def area_size_limit
  options[:area_size_limit]
end
blank?() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 37
def blank?
  region.nil? || region_area_size.zero?
end
coordinates() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 53
def coordinates
  region&.to_edge_coordinates
end
different?() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 9
def different?
  failed? || !(blank? || tolerable?)
end
equal?() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 13
def equal?
  !different?
end
failed?() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 17
def failed?
  !!failed_by
end
inspect() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 57
def inspect
  to_h.to_json
end
options() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 21
def options
  comparison.options
end
ratio() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 45
def ratio
  meta[:difference_level]
end
region_area_size() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 41
def region_area_size
  region&.size || 0
end
skip_area() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 29
def skip_area
  options[:skip_area]
end
to_h() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 49
def to_h
  {area_size: region_area_size, region: coordinates}.merge!(meta)
end
tolerable?() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 61
def tolerable?
  !!((area_size_limit && area_size_limit >= region_area_size) || (tolerance && tolerance >= ratio))
end
tolerance() click to toggle source
# File lib/capybara/screenshot/diff/difference.rb, line 25
def tolerance
  options[:tolerance]
end