Skip to content

Commit 43d14f5

Browse files
pftgclaude
andcommitted
refactor: clean up file size check variables in quick_equal?
Extract base_size/new_size for clarity. Prepares for future file size ratio pre-rejection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 887040b commit 43d14f5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/capybara/screenshot/diff/image_compare.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ def initialize(image_path, base_image_path, options = {})
6161
#
6262
# @note This method will raise ArgumentError if either image file is missing.
6363
def quick_equal?
64-
# Quick file size check - if sizes are equal, perform a simple file comparison
65-
if base_image_path.size == image_path.size
66-
# If we have identical files (same size and content), we can return true immediately
67-
# without more expensive comparison
64+
base_size = base_image_path.size
65+
new_size = image_path.size
66+
67+
# Exact same file size — likely identical, verify with byte comparison
68+
if base_size == new_size
6869
return true if files_identical?(base_image_path, image_path)
6970
end
7071

0 commit comments

Comments
 (0)