Skip to content

Repository files navigation

Lookalike

Gem version Downloads CI Ruby License

Golden image comparison for Ruby graphics.

Lookalike turns rendered images into visual regression tests. It compares Tessel images, file paths, and framebuffer-like objects, then writes actionable diffs for failed snapshots.

Features · Installation · Quick start · Development

Features

  • Channel and YIQ perceptual comparison modes.
  • Per-pixel deltas, allowed-pixel limits, bounding boxes, and diff images.
  • Optional antialiasing detection for cleaner UI and text snapshots.
  • RSpec, Minitest, and Test::Unit assertion helpers.
  • Snapshot approval flow for local development and CI.
  • HTML reports with an expected/actual overlay slider.

Installation

Add Lookalike to your Gemfile:

gem "lookalike"

Then run:

bundle install

Or install the released gem:

gem install lookalike

Quick start

require "lookalike"

actual = Tessel.read("actual.png")
result = Lookalike.compare("expected.png", actual, mode: :channel, max_delta: 1)
abort result.inspect unless result.match?

For snapshot assertions, include Lookalike::Assertions in the test context:

include Lookalike::Assertions

assert_snapshot(render_scene, "home")

Missing snapshots are pending locally. Approve them with:

LOOKALIKE_UPDATE=1 bundle exec rake
lookalike approve NAME
lookalike approve --all
lookalike report tmp/lookalike

Set CI to make missing snapshots fail.

Development

bundle install
bundle exec rake verify

License

MIT

About

Golden image comparison for Ruby graphics

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages