Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
group :test do
gem "capybara", ">= 3.26"
gem "mutex_m" # Needed for RubyMine debugging. Try removing it.
gem "minitest", require: false
gem "minitest", "< 6", require: false
gem "minitest-stub-const", require: false
Comment on lines 17 to 19

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider adding a lower version bound or a narrower constraint for minitest

Using < 6 alone could pull in very old minitest versions with missing features or known issues. To better match the versions you actually support and test with, use a narrower range like "~> 5.0" or ">= 5.0", "< 6".

Suggested change
gem "mutex_m" # Needed for RubyMine debugging. Try removing it.
gem "minitest", require: false
gem "minitest", "< 6", require: false
gem "minitest-stub-const", require: false
gem "mutex_m" # Needed for RubyMine debugging. Try removing it.
gem "minitest", ">= 5.0", "< 6", require: false
gem "minitest-stub-const", require: false

gem "simplecov", require: false
gem "rspec", require: false
Expand Down
12 changes: 6 additions & 6 deletions lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ def shift_distance_at(new_img, old_img, x, y, color_distance_limit:)
if (x - shift_distance) >= 0 # left
([0, top_row + 1].max..[y + shift_distance, new_img.height - 2].min)
.each do |dy|
if color_matches(new_img, org_color, x - shift_distance, dy, color_distance_limit)
return shift_distance
if color_matches(new_img, org_color, x - shift_distance, dy, color_distance_limit)
return shift_distance
end
end
end
else
bounds_breached += 1
end
Expand All @@ -273,10 +273,10 @@ def shift_distance_at(new_img, old_img, x, y, color_distance_limit:)
if (x + shift_distance) < new_img.width # right
([0, top_row + 1].max..[y + shift_distance, new_img.height - 2].min)
.each do |dy|
if color_matches(new_img, org_color, x + shift_distance, dy, color_distance_limit)
return shift_distance
if color_matches(new_img, org_color, x + shift_distance, dy, color_distance_limit)
return shift_distance
end
end
end
else
bounds_breached += 1
end
Expand Down
Loading