fix: quick wins — Quick Start, error messages, RSpec matcher#167
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The matcher description now includes the screenshot name. Added failure_message and failure_message_when_negated for proper RSpec matcher protocol. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Complete working example before the feature list — reduces time-to-first-green from reading the whole README to copying 3 code blocks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reviewer's GuideAdds a 60-second Quick Start example to the README, improves the missing-baseline error message with concrete recording instructions, and enriches the RSpec Class diagram for updated RSpec match_screenshot matcherclassDiagram
class MatchScreenshotMatcher {
- expected_label String
- options Hash
+ initialize(expected_label, options)
+ matches?(page)
+ failure_message() String
+ description() String
}
class CapybaraScreenshotDiff_RSpecIntegration {
+ match_screenshot(expected_label, options) MatchScreenshotMatcher
}
CapybaraScreenshotDiff_RSpecIntegration ..> MatchScreenshotMatcher : creates
Flow diagram for updated missing-baseline error guidanceflowchart TD
Start[Start baseline check] --> HasBase[Does baseline screenshot exist?]
HasBase -->|Yes| Continue[Compare current screenshot with baseline]
HasBase -->|No| FailIfNew[Is fail_if_new enabled?]
FailIfNew -->|No| AllowNew[Allow creating new baseline without error]
FailIfNew -->|Yes| RaiseError[Raise ExpectationNotMet with extended message]
RaiseError --> Msg1[Show line: No existing screenshot found for path]
Msg1 --> Msg2[Show line: To record baselines: RECORD_SCREENSHOTS=1 bundle exec rake test]
Msg2 --> Msg3[Show line: To allow new screenshots: Capybara::Screenshot::Diff.fail_if_new = false]
Continue --> End[Finish test]
AllowNew --> End
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 0 minutes and 30 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new error message hardcodes
RECORD_SCREENSHOTS=1 bundle exec rake test, which may not match projects using different test runners (e.g., RSpec or custom commands); consider phrasing it more generically or mentioning alternatives (e.g.,RECORD_SCREENSHOTS=1 <your test command>).
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new error message hardcodes `RECORD_SCREENSHOTS=1 bundle exec rake test`, which may not match projects using different test runners (e.g., RSpec or custom commands); consider phrasing it more generically or mentioning alternatives (e.g., `RECORD_SCREENSHOTS=1 <your test command>`).Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Helps users know which settings to reach for at each stage instead of reading all 24 options upfront. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers: missing baselines, CI vs local differences, animations, dynamic content, and silent assertion skipping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
failure_messageanddescriptionto RSpecmatch_screenshotmatcherTest plan
🤖 Generated with Claude Code
Summary by Sourcery
Improve onboarding, error guidance, and RSpec matcher usability for capybara-screenshot-diff.
Enhancements:
Documentation: