capybara-screenshot-diff 0.8.2 → 0.9.0

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: 32cab54cf8495b41d5cba232bed69ea8ec71ab29
4
- data.tar.gz: 4dca8a2504dc6b6e968ae8dda4909708e7db5a53
3
+ metadata.gz: d2120b8b0ac6dc51602035b78721b827f0cf46ff
4
+ data.tar.gz: da5976f808661db8cb1202b9220a93577f785c26
5
5
  SHA512:
6
- metadata.gz: 2b774e371359fdd5bbb8a4a8edc7a163fc1c591cc8de84ff00d1e62b984bc7e3c089a4bf2f28266c1a5e77ff7e29324052d3df373c0330f44dd9658c6895f415
7
- data.tar.gz: 61b8bfd71ae2da33b369a628bcf9677bac7f5023c02ae47a15216d62955f246d43e168d1307a2824db8c57a528f69ab75a5606ff7abb8377f9045d010f2fb337
6
+ metadata.gz: c4c01c8b9fc384c468f3e01e1ee92c4a17fe53b42a60cbd3e6fc86b040d442fa936993ddc10b1043e3fc219bd225e3ccb87ada0749f3793695dca58bcaf5dadf
7
+ data.tar.gz: 84f94aea83761a7dc55ce972cb98cedc31c7c2db0806834048528fdf636c320d4d1a352afa82102a2334d3042ce6b3bd27adaacd6e881d8150d187e1cbfc975c
data/.rubocop_todo.yml CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  # Offense count: 7
10
10
  Metrics/AbcSize:
11
- Max: 37
11
+ Max: 38
12
12
 
13
13
  # Offense count: 1
14
14
  # Configuration parameters: CountComments.
@@ -63,7 +63,7 @@ module Capybara
63
63
  def take_stable_screenshot(comparison)
64
64
  input = prepare_page_for_screenshot
65
65
  previous_file_name = comparison.old_file_name
66
- screeenshot_started_at = last_image_change_at = Time.now
66
+ screenshot_started_at = last_image_change_at = Time.now
67
67
  loop.with_index do |_x, i|
68
68
  take_right_size_screenshot(comparison)
69
69
 
@@ -87,12 +87,12 @@ module Capybara
87
87
  last_image_change_at = Time.now
88
88
  end
89
89
 
90
- assert (Time.now - screeenshot_started_at) < Capybara.default_max_wait_time,
90
+ assert (Time.now - screenshot_started_at) < Capybara.default_max_wait_time,
91
91
  "Could not get stable screenshot within #{Capybara.default_max_wait_time}s\n" \
92
92
  "#{stabilization_images(comparison.new_file_name).join("\n")}"
93
93
  end
94
94
 
95
- previous_file_name = "#{comparison.new_file_name.chomp('.png')}_x#{i}.png~"
95
+ previous_file_name = "#{comparison.new_file_name.chomp('.png')}_x#{format('%02i', i)}.png~"
96
96
 
97
97
  FileUtils.mv comparison.new_file_name, previous_file_name
98
98
  end
@@ -95,8 +95,17 @@ module Capybara
95
95
 
96
96
  def assert_image_not_changed(caller, name, comparison)
97
97
  return unless comparison.different?
98
+
99
+ # TODO(uwe): Remove check when we stop supporting Ruby 2.3 and older
100
+ max_color_distance = if RUBY_VERSION >= '2.4'
101
+ comparison.max_color_distance.ceil(1)
102
+ else
103
+ comparison.max_color_distance.ceil
104
+ end
105
+ # ODOT
106
+
98
107
  "Screenshot does not match for '#{name}' (area: #{comparison.size}px #{comparison.dimensions}" \
99
- ", max_color_distance: #{comparison.max_color_distance.ceil(1)})\n" \
108
+ ", max_color_distance: #{max_color_distance})\n" \
100
109
  "#{comparison.new_file_name}\n#{comparison.annotated_old_file_name}\n" \
101
110
  "#{comparison.annotated_new_file_name}\n" \
102
111
  "at #{caller}"
@@ -3,7 +3,7 @@
3
3
  module Capybara
4
4
  module Screenshot
5
5
  module Diff
6
- VERSION = '0.8.2'.freeze
6
+ VERSION = '0.9.0'.freeze
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-screenshot-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-18 00:00:00.000000000 Z
11
+ date: 2017-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack