capybara-screenshot-diff 1.9.2 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87328c5152c18c006da12b39c30f0389ac0f7b71174530473681ac98e035b884
4
- data.tar.gz: ec54883ea6de4b75fa5be917fee79e5098a18cd1c5ea3ebbfceb567661e148d3
3
+ metadata.gz: bfdd68a006e25a2b4eb1a8e96899b8ed168cb9e84311bc3c883e9a44a66920f8
4
+ data.tar.gz: 298366cf80e500f29a7c05b45f5eeeaf0db735cf6dda8b2e7622fbf059dfbdef
5
5
  SHA512:
6
- metadata.gz: 7e5f89855ddaf008feab8705c6e13f495b654a7dd382fe209ac5e5917fca00553765dfcf411b90cd83aecd931fec6055502dcf3cf7ee0d69c21e8edaa891cbdc
7
- data.tar.gz: 9f402d5ff1ed20d02c0e6fd3d7d025fc7e82287e7d159a6fb892c21cf0f8bf6db74257ba22560631ef179f191cce2de78f099b4a47b637a9d6f91eaededa7ddd
6
+ metadata.gz: bf437d7b0ff41f9a9ecc696cec94a018079ff980faff96aa194ad050fd75940940042dc63f367d411d98084d67de81e01a36c26cda6127c9f2440ec576e49de6
7
+ data.tar.gz: 4e203cd3339974151eb7ab7261eef59b3896875144462970dcded50c665e939bbd845cb4f78741e2e4a7f0180be31bb1e96561ed3ef71600959dfaeca76b9001
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = "Track your GUI changes with diff assertions"
13
13
  spec.description = "Save screen shots and track changes with graphical diff"
14
14
  spec.homepage = "https://github.com/donv/capybara-screenshot-diff"
15
- spec.required_ruby_version = ">= 3.0.0"
15
+ spec.required_ruby_version = ">= 3.1"
16
16
  spec.license = "MIT"
17
17
  spec.metadata["allowed_push_host"] = "https://rubygems.org/"
18
18
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_runtime_dependency "actionpack", ">= 6.1", "< 9"
26
+ spec.add_runtime_dependency "actionpack", ">= 7.0", "< 9"
27
27
  spec.add_runtime_dependency "capybara", ">= 2", "< 4"
28
28
  end
data/gems.rb CHANGED
@@ -12,11 +12,14 @@ gem "chunky_png", ">= 1.3", require: false
12
12
  gem "oily_png", platform: :ruby, git: "https://github.com/wvanbergen/oily_png", ref: "44042006e79efd42ce4b52c1d78a4c70f0b4b1b2"
13
13
  gem "ruby-vips", require: false
14
14
 
15
- # Test
16
- gem "minitest", require: false
17
- gem "minitest-stub-const", require: false
18
- gem "simplecov", require: false
19
- gem "rspec", require: false
15
+ group :test do
16
+ gem "capybara", ">= 3.26"
17
+ gem 'mutex_m' # Needed for RubyMine debugging. Try removing it.
18
+ gem "minitest", require: false
19
+ gem "minitest-stub-const", require: false
20
+ gem "simplecov", require: false
21
+ gem "rspec", require: false
22
+ end
20
23
 
21
24
  # Capybara Server
22
25
  gem "puma", require: false
@@ -123,9 +123,10 @@ module Capybara
123
123
  screenshot_full_name = build_full_name(name)
124
124
  job = build_screenshot_matches_job(screenshot_full_name, options)
125
125
 
126
+ caller = caller(skip_stack_frames + 1).reject { |l| l =~ /gems\/(activesupport|minitest|railties)/ }
126
127
  unless job
127
128
  if Screenshot::Diff.fail_if_new
128
- raise_error(<<-ERROR.strip_heredoc, caller(2))
129
+ _raise_error(<<-ERROR.strip_heredoc, caller)
129
130
  No existing screenshot found for #{screenshot_full_name}!
130
131
  To stop seeing this error disable by `Capybara::Screenshot::Diff.fail_if_new=false`
131
132
  ERROR
@@ -134,13 +135,13 @@ module Capybara
134
135
  return false
135
136
  end
136
137
 
137
- job.prepend(caller(skip_stack_frames))
138
+ job.prepend(caller)
138
139
 
139
140
  if Screenshot::Diff.delayed
140
141
  schedule_match_job(job)
141
142
  else
142
143
  error_msg = assert_image_not_changed(*job)
143
- raise_error(error_msg, caller(2)) if error_msg
144
+ _raise_error(error_msg, caller(2)) if error_msg
144
145
  end
145
146
  end
146
147
 
@@ -163,12 +164,12 @@ module Capybara
163
164
 
164
165
  return unless result
165
166
 
166
- "Screenshot does not match for '#{name}' #{comparison.error_message}\n#{caller.join(", ")}"
167
+ "Screenshot does not match for '#{name}' #{comparison.error_message}\n#{caller.join("\n")}"
167
168
  end
168
169
 
169
170
  private
170
171
 
171
- def raise_error(error_msg, backtrace)
172
+ def _raise_error(error_msg, backtrace)
172
173
  raise CapybaraScreenshotDiff::ExpectationNotMet.new(error_msg).tap { _1.set_backtrace(backtrace) }
173
174
  end
174
175
 
@@ -3,7 +3,7 @@
3
3
  module Capybara
4
4
  module Screenshot
5
5
  module Diff
6
- VERSION = "1.9.2"
6
+ VERSION = '1.10.1'
7
7
  end
8
8
  end
9
9
  end
@@ -19,10 +19,10 @@ module CapybaraScreenshotDiff
19
19
  module Assertions
20
20
  include ::CapybaraScreenshotDiff::DSL
21
21
 
22
- def screenshot(*, **)
23
- super
24
- rescue CapybaraScreenshotDiff::ExpectationNotMet => e
25
- raise ::Minitest::Assertion, e.message
22
+ def screenshot(*args, skip_stack_frames: 0, **opts)
23
+ assert_nothing_raised do
24
+ super(*args, skip_stack_frames: skip_stack_frames + 3, **opts)
25
+ end
26
26
  end
27
27
 
28
28
  alias_method :assert_matches_screenshot, :screenshot
@@ -37,7 +37,11 @@ module CapybaraScreenshotDiff
37
37
  klass.teardown do
38
38
  errors = verify_screenshots!(@test_screenshots)
39
39
 
40
- failures << ::Minitest::Assertion.new(errors.join("\n\n")) if errors && !errors.empty?
40
+ if errors.present?
41
+ assertion = ::Minitest::Assertion.new(errors.join("\n\n"))
42
+ assertion.set_backtrace []
43
+ failures << assertion
44
+ end
41
45
  end
42
46
  end
43
47
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-screenshot-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-11-20 00:00:00.000000000 Z
10
+ date: 2024-12-31 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: actionpack
@@ -16,7 +15,7 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '6.1'
18
+ version: '7.0'
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
21
  version: '9'
@@ -26,7 +25,7 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: '6.1'
28
+ version: '7.0'
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: '9'
@@ -96,7 +95,6 @@ licenses:
96
95
  - MIT
97
96
  metadata:
98
97
  allowed_push_host: https://rubygems.org/
99
- post_install_message:
100
98
  rdoc_options: []
101
99
  require_paths:
102
100
  - lib
@@ -104,15 +102,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
102
  requirements:
105
103
  - - ">="
106
104
  - !ruby/object:Gem::Version
107
- version: 3.0.0
105
+ version: '3.1'
108
106
  required_rubygems_version: !ruby/object:Gem::Requirement
109
107
  requirements:
110
108
  - - ">="
111
109
  - !ruby/object:Gem::Version
112
110
  version: '0'
113
111
  requirements: []
114
- rubygems_version: 3.5.22
115
- signing_key:
112
+ rubygems_version: 3.6.2
116
113
  specification_version: 4
117
114
  summary: Track your GUI changes with diff assertions
118
115
  test_files: []