Skip to content

feat: snapshot inline diff — line-by-line diff on mismatch#38

Merged
eclectic-coding merged 1 commit into
mainfrom
feat/1.5-snapshot-inline-diff
Jun 2, 2026
Merged

feat: snapshot inline diff — line-by-line diff on mismatch#38
eclectic-coding merged 1 commit into
mainfrom
feat/1.5-snapshot-inline-diff

Conversation

@eclectic-coding

Copy link
Copy Markdown
Owner

Closes #32.

Summary

match_turbo_stream_snapshot failure message now shows a diff/lcs-powered line-by-line diff instead of raw before/after strings.

Before:

expected response to match turbo stream snapshot "messages/new"

stored:
<turbo-stream action="append" target="messages">...</turbo-stream>

actual:
<turbo-stream action="replace" target="messages">...</turbo-stream>

To update: run with UPDATE_TURBO_SNAPSHOTS=1

After:

expected response to match turbo stream snapshot "messages/new"

diff (stored → actual):
- <turbo-stream action="append" target="messages">...</turbo-stream>
+ <turbo-stream action="replace" target="messages">...</turbo-stream>

To update: run with UPDATE_TURBO_SNAPSHOTS=1

diff-lcs is already available as a transitive dependency via RSpec — no new gem dependency added.

Test plan

  • 304 examples, 0 failures
  • 100% line and branch coverage

🤖 Generated with Claude Code

Closes #32.

match_turbo_stream_snapshot failure_message now uses Diff::LCS to
produce a line-by-line diff (stored → actual) instead of dumping raw
before/after strings. Changed lines are prefixed with - or + and a
whitespace-only fallback message is shown when the strip-normalized
strings differ only in surrounding whitespace.

304 examples, 100% line and branch coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@eclectic-coding
eclectic-coding merged commit d19f6f9 into main Jun 2, 2026
11 checks passed
@eclectic-coding
eclectic-coding deleted the feat/1.5-snapshot-inline-diff branch June 2, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: snapshot inline diff for match_turbo_stream_snapshot

1 participant