Skip to content

Commit

Permalink
Auto-fix standardrb errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pftg committed Oct 31, 2023
1 parent 6a113e2 commit 8c658e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/capybara/screenshot/diff/image_compare.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ def annotate_and_save_image(difference, image, image_path)
DIFF_COLOR = [255, 0, 0, 255].freeze

def annotate_difference(image, region)
driver.draw_rectangles(Array[image], region, DIFF_COLOR, offset: 1).first
driver.draw_rectangles([image], region, DIFF_COLOR, offset: 1).first
end

SKIP_COLOR = [255, 192, 0, 255].freeze

def annotate_skip_areas(image, skip_areas)
skip_areas.reduce(image) do |memo, region|
driver.draw_rectangles(Array[memo], region, SKIP_COLOR).first
driver.draw_rectangles([memo], region, SKIP_COLOR).first
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/capybara/screenshot/diff/image_compare_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require "capybara/screenshot/diff/drivers/chunky_png_driver"
if defined?(Vips)
require "capybara/screenshot/diff/drivers/vips_driver"
elsif ENV['SCREENSHOT_DRIVER'] == 'vips'
elsif ENV["SCREENSHOT_DRIVER"] == "vips"
raise 'Required `ruby-vips` gem or `vips` library is missing. Ensure "ruby-vips" gem and "vips" library is installed.'
end

Expand Down Expand Up @@ -43,10 +43,10 @@ class ImageCompareTest < ActionDispatch::IntegrationTest

test "it can handle very long input filenames" do
skip "VIPS not present. Skipping VIPS driver tests." unless defined?(Vips)
filename = %w(this-0000000000000000000000000000000000000000000000000-path/is/extremely/
filename = %w[this-0000000000000000000000000000000000000000000000000-path/is/extremely/
long/and/if/the/directories/are/flattened/in/
the_temporary_they_will_cause_the_filename_to_exceed_
the_limit_on_most_unix_systems_which_nobody_wants.png).join
the_limit_on_most_unix_systems_which_nobody_wants.png].join
comparison = make_comparison(:a, :b, destination: (Rails.root / filename), driver: :vips)

assert comparison.different?
Expand Down
2 changes: 1 addition & 1 deletion test/integration/browser_screenshot_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def test_screenshot_selected_element
def test_await_all_images_are_loaded
visit "/index.html"
assert_raises Minitest::Assertion do
BrowserHelpers.stub(:pending_image_to_load, 'http://127.0.0.1:62815/image.png') do
BrowserHelpers.stub(:pending_image_to_load, "http://127.0.0.1:62815/image.png") do
screenshot :index
end
end
Expand Down

0 comments on commit 8c658e5

Please sign in to comment.