Skip to content

Commit 3331012

Browse files
pftgclaude
andcommitted
fix: freeze options hash and widen rescue in files_identical?
Address PR review feedback: - Freeze options instead of sharing mutable reference - Add IOError to rescue alongside SystemCallError Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 835f45b commit 3331012

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/capybara/screenshot/diff/image_compare.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def initialize(image_path, base_image_path, options = {})
4646

4747
ensure_files_exist!
4848

49-
@driver_options = options
49+
@driver_options = options.freeze
5050
@driver = Drivers.for(@driver_options)
5151
end
5252

@@ -184,7 +184,7 @@ def images_exist?
184184
# Check if files are identical by content
185185
def files_identical?(file1, file2)
186186
FileUtils.compare_file(file1, file2)
187-
rescue SystemCallError
187+
rescue SystemCallError, IOError
188188
false
189189
end
190190
end

0 commit comments

Comments
 (0)