Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Insta: Snapshot Testing for Ruby @ EuRuKo 2026,...

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for Marco Roth Marco Roth
September 17, 2026

Insta: Snapshot Testing for Ruby @ EuRuKo 2026, Brno, Czechia

Most Ruby tests rely on manually maintained assertions. What if your test suite could show you exactly what changed and let you approve those changes with a single command?

Inspired by Rust’s popular Insta library, this talk introduces snapshot testing for Ruby and demonstrates how snapshots, diffs, and review workflows can make testing complex output simpler, more expressive, and easier to maintain. Extracted from Herb's test suite.

Avatar for Marco Roth

Marco Roth

September 17, 2026

More Decks by Marco Roth

Other Decks in Programming

Transcript

  1. Marco Roth Insta: Snapshot Testing for Ruby Sep 17, 2026

    - EuRuKo 2026 - Brno, Czech Republic
  2. Where you want to assert the whole thing, without having

    to write an assertion for every detail.
  3. require "test_helper" class UserSerializerTest < Minitest::Test def test_user_json expected =

    '{"id":42,"name":"Ada","role":"admin","created_at":" assert_equal UserSerializer.render(ADA), expected end def test_admin_json expected = '{"id":7,"name":"Grace","role":"owner","created_at": assert_equal UserSerializer.render(GRACE), expected end end
  4. Now, we would have to go through all tests and

    add avatar_url, even though we can see that the actual value was right
  5. ✓ Minitest + RSpec ✓ file snapshots (.snap + YAML

    frontmatter, source metadata) ✓ inline snapshots (Prism-powered file rewriting) ✓ interactive review CLI (review · accept · reject · pending · status · clean) ✓ difftastic structural diffs ✓ serializers: to_s · inspect · json · yaml ✓ redactions (jq-like selectors) ✓ INSTA_UPDATE modes + CI auto-detection ✓ per-snapshot metadata (input · description · info)
  6. Where snapshots shine: •API responses (the full JSON) •rendered HTML

    views •ASTs •compiled output •CLI output •error messages
  7. l b g g M t Thank you 🙏 @marcoroth

    marcoroth.dev @marcoroth_ @marcoroth.dev @[email protected] /in/marco-roth