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
- 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.
Add Lookalike to your Gemfile:
gem "lookalike"Then run:
bundle installOr install the released gem:
gem install lookalikerequire "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/lookalikeSet CI to make missing snapshots fail.
bundle install
bundle exec rake verify