Skip to content

Commit 87e3cdf

Browse files
pftgclaude
andcommitted
refactor: replace 0.step with loop in StableScreenshoter
Simpler loop construct. Move sleep after checks instead of guarding with i == 0 — same behavior, clearer intent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 249cf6e commit 87e3cdf

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lib/capybara/screenshot/diff/stable_screenshoter.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,13 @@ def take_stable_screenshot(snapshot)
6161
# Cleanup all previous attempts for sure
6262
snapshot.cleanup_attempts!
6363

64-
0.step do |i|
65-
# FIXME: it should be wait, and wait should be replaced with stability_time_limit
66-
sleep(stability_time_limit) unless i == 0 # test prev_attempt_path is nil
67-
64+
loop do
6865
attempt_next_screenshot(snapshot)
6966

7067
return true if attempt_successful?(snapshot)
7168
return false if timeout?(deadline_at)
69+
70+
sleep(stability_time_limit)
7271
end
7372
end
7473

0 commit comments

Comments
 (0)