capybara-screenshot-diff 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31b02395af8b464ceeb774dbf6364497e0127daa
4
- data.tar.gz: 2bd199042023db6a41d51e0312fb791d2da0ece6
3
+ metadata.gz: 4918e7dba3e123055b2c5aae345fce7dd8a1219d
4
+ data.tar.gz: 662f6f68099b888e068a62ec18454ddbcdf2adf6
5
5
  SHA512:
6
- metadata.gz: 116bc4c1258f770998f2451ab3abcb124bc4b6926961e4cae7edf3cb32e128d990fed362b18b1226d9c84fdfb92fb88e21bffb5691fe6faf5077884bd1d6e7e9
7
- data.tar.gz: a40a2b6e2f471d9762fc0e2cfe8da22ec3a89bf5ccbb0971ef5afb43944386193a3636849281194094c2810e24905a755ede1e3ac700580057d32cc1da02912d
6
+ metadata.gz: 6929b38a90048524ec74c867f93a2b14160c34cae83d325963bfefd0bbd28a134e9f3471360b3649226b33e43414d60da35ccab499d4101fddac08688eed91ab
7
+ data.tar.gz: 3638b34d359a68c75eaaa49593396efc227383126259b95ad5af12b6e75103164bd9b7f22485cf97831f83415defcb8f5072923de6cdbfedb8b450836ff692e9
@@ -97,9 +97,10 @@ module ActionDispatch
97
97
 
98
98
  teardown do
99
99
  if Capybara::Screenshot::Diff.enabled && @test_screenshots
100
- @test_screenshots.each { |args| assert_image_not_changed(*args) }
100
+ test_screenshot_errors =
101
+ @test_screenshots.map { |args| assert_image_not_changed(*args) }.compact
102
+ fail(test_screenshot_errors.join("\n\n")) if test_screenshot_errors.any?
101
103
  end
102
- fail(@test_screenshot_errors.join("\n\n")) if @test_screenshot_errors
103
104
  end
104
105
 
105
106
  def screenshot_section(name)
@@ -227,8 +228,7 @@ EOF
227
228
  def assert_image_not_changed(caller, name, file_name, committed_file_name, new_name, org_name)
228
229
  if Capybara::Screenshot::Diff::ImageCompare.compare(committed_file_name, file_name,
229
230
  Capybara::Screenshot.window_size)
230
- (@test_screenshot_errors ||= []) <<
231
- "Screenshot does not match for '#{name}'\n#{file_name}\n#{org_name}\n#{new_name}\nat #{caller}"
231
+ "Screenshot does not match for '#{name}'\n#{file_name}\n#{org_name}\n#{new_name}\nat #{caller}"
232
232
  end
233
233
  end
234
234
  end
@@ -99,8 +99,8 @@ module Capybara
99
99
 
100
100
  def find_diff_rectangle(org_img, new_img)
101
101
  top = bottom = nil
102
- left = org_img.width
103
- right = -1
102
+ left = org_img.width - 1
103
+ right = 0
104
104
  org_img.height.times do |y|
105
105
  (0...left).find do |x|
106
106
  next if org_img[x, y] == new_img[x, y]
@@ -118,7 +118,7 @@ module Capybara
118
118
  end
119
119
  end
120
120
  (org_img.height - 1).step(bottom + 1, -1).find do |y|
121
- ((left + 1)..(right - 1)).find do |x|
121
+ (left..right).find do |x|
122
122
  bottom = y if org_img[x, y] != new_img[x, y]
123
123
  end
124
124
  end
@@ -3,7 +3,7 @@
3
3
  module Capybara
4
4
  module Screenshot
5
5
  module Diff
6
- VERSION = '0.5.2'.freeze
6
+ VERSION = '0.5.3'.freeze
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-screenshot-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch