snap_diff-capybara 2.0.0.beta2 → 2.0.0.beta3

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
  SHA256:
3
- metadata.gz: 480337577271341982e3f8eef57cf123003092ba90833e4b4a497676920c0466
4
- data.tar.gz: e844a383454976b32c46059e4593dd0c472133d22eac3e1d531b6bca35935f6e
3
+ metadata.gz: 8807b325d8008757c4d15af8f81361f00249539c93b17304d44ce0120ffa4f0e
4
+ data.tar.gz: d285b26c779add8576a9fcd347bf4460238d1c89a488535465db83d331d9b5f2
5
5
  SHA512:
6
- metadata.gz: b44e77a9e696cd8f326655ba6bd19d5b4275f7f2b86ea0961c913dc30d1ecb6eb0806fa89340359357049bf70c2c015ccaf4d22fc9f6d733c84788db358435f4
7
- data.tar.gz: 322a1b64abd4bc2234dea9f6ffcda02f7dac5e9e09c640f1f6decc588b0715953add332a08a61e685bec944358b80b999f77a17b5524663e6c107f771ad7a2fb
6
+ metadata.gz: 57890b29242441e7afe1b8be5de45a7ebea5f23752a7d806cdb2dbfbcf49ccf7c27289fc4ea40a148728eaab2396a88b843c95fcd1641d82b7a5adc8950b7835
7
+ data.tar.gz: ea38f270abcd858cb71830d2268bba8a54d6ccc5ffa3fffc63828b3dbe0a8bf0a21c9e5354c3683983913915be93b6564e15ec367ec9680a83f22e64e3bedddf
data/CHANGELOG.md CHANGED
@@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [v2.0.0.beta3] - 2026-08-23
9
+
10
+ Fixes the canonical `SnapDiff` entry points, which were incomplete in beta2.
11
+ If you are trying the 2.0 experiment on the new API, upgrade — beta2's
12
+ documented quick start does not work.
13
+
14
+ ### Fixed
15
+ - **`require "snap_diff/integrations/minitest"` (and rspec/cucumber/dsl/static)
16
+ now load the full `SnapDiff` surface.** In beta2 those entry points left
17
+ `SnapDiff.configure`, `.start`, `.compare` and `SnapDiff::VERSION` undefined,
18
+ so the quick start in the canonical guide raised `NoMethodError`
19
+ - **The dual-install guard now runs on every canonical entry point.** In beta2
20
+ it lived only in `require "snap_diff"`, so the recommended path was the one
21
+ place it never fired
22
+ - **Legacy entry points keep the full `CapybaraScreenshotDiff` session surface** —
23
+ `require "capybara/screenshot/diff/cucumber"` and
24
+ `require "capybara_screenshot_diff/static"` lost `verify`/`reset`/`reporters`
25
+ and friends in beta2 while the module stayed defined, so calls failed late
26
+ - **`Capybara::Screenshot::Diff::Reporters::Default` and
27
+ `…::Diff::Comparison` are eager aliases again**, so `defined?` and
28
+ `const_defined?` report them as they did in beta1. beta2 made them lazy,
29
+ which silently broke feature detection — and made beta2's own compatibility
30
+ note inaccurate for those two constants
31
+ - **`SnapDiff::Error` is now the catch-all the docs promise** —
32
+ `WindowSizeMismatchError` and `DualInstallError` inherit it, so
33
+ `rescue SnapDiff::Error` catches every error the gem raises
34
+ - **`gem "snap_diff-capybara"` works with `Bundler.require`** — the gem had no
35
+ matching entry file, so Rails users got nothing loaded and a confusing
36
+ `NameError` later
37
+ - Reporter failure warnings use one brand and name the failing reporter class
38
+
39
+ ---
40
+
8
41
  ## [v2.0.0.beta2] - 2026-08-23
9
42
 
10
43
  Third prerelease of the 2.0 opt-in experiment. This one finishes the namespace
data/docs/UPGRADING.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Version 2.0 introduces a new canonical namespace (`SnapDiff`) for cleaner, more discoverable code. The public DSL remains unchanged — your existing `screenshot` and `assert_matches_screenshot` calls work without modification. This guide covers the optional migration path for settings and the new namespace.
8
8
 
9
- **Status:** `2.0.0.beta2` is an opt-in prerelease. RubyGems never installs prereleases by default resolution — normal `bundle update` keeps you on the 1.x line. The final 2.0.0 ships only after adopter feedback; please report anything surprising on [#166](https://github.com/snap-diff/snap_diff-capybara/issues/166).
9
+ **Status:** `2.0.0.beta3` is an opt-in prerelease. RubyGems never installs prereleases by default resolution — normal `bundle update` keeps you on the 1.x line. The final 2.0.0 ships only after adopter feedback; please report anything surprising on [#166](https://github.com/snap-diff/snap_diff-capybara/issues/166).
10
10
 
11
11
  **Estimated upgrade time:** 5–15 minutes (most users need only the Gemfile pin)
12
12
 
@@ -22,7 +22,7 @@ with canonical names only, no legacy shapes to unlearn.
22
22
 
23
23
  ```ruby
24
24
  # In your Gemfile — the exact prerelease version is required to opt in
25
- gem "capybara-screenshot-diff", "2.0.0.beta2" # or the latest 2.0.0 prerelease
25
+ gem "capybara-screenshot-diff", "2.0.0.beta3" # or the latest 2.0.0 prerelease
26
26
  ```
27
27
 
28
28
  ```bash
@@ -233,7 +233,7 @@ All settings and baselines are compatible with v1.x. Simply pin your Gemfile bac
233
233
 
234
234
  ### Summary Checklist
235
235
 
236
- - [ ] Pin `gem "capybara-screenshot-diff", "2.0.0.beta2"` (or the latest 2.0.0 prerelease) in your Gemfile
236
+ - [ ] Pin `gem "capybara-screenshot-diff", "2.0.0.beta3"` (or the latest 2.0.0 prerelease) in your Gemfile
237
237
  - [ ] Run `bundle install`
238
238
  - [ ] Run your test suite to verify no regressions
239
239
  - [ ] (Optional) Migrate config to the `SnapDiff` namespace
@@ -1,3 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "snap_diff/integrations/cucumber"
3
+ # Legacy (v1-documented) entry point: like every other legacy entry, it must
4
+ # load the legacy surface too -- requiring only the canonical integration
5
+ # left CapybaraScreenshotDiff half-present (module defined, but .verify /
6
+ # .reset / .reporters / ... gone) for v1 users of this path.
7
+ require "capybara_screenshot_diff/cucumber"
@@ -6,10 +6,22 @@
6
6
  # snap_diff/comparison itself pulls in the ComparisonResult and Drivers
7
7
  # units, and the shims keep the old ::Difference / ::Drivers names
8
8
  # resolvable, so this path still provides everything the pre-move
9
- # image_compare.rb did. The internal images-holder struct lives at
10
- # SnapDiff::Comparison::Images (its old ::Comparison name resolves via the
11
- # shims) and the driver cache at SnapDiff::Drivers.loaded, with
12
- # LOADED_DRIVERS kept as an eager same-object alias by legacy_shims
13
- # (ADR-008 step 5).
9
+ # image_compare.rb did. The images-holder struct lives at
10
+ # SnapDiff::Comparison::Images and the driver cache at
11
+ # SnapDiff::Drivers.loaded, with LOADED_DRIVERS kept as an eager same-object
12
+ # alias by legacy_shims (ADR-008 step 5).
14
13
  require "snap_diff/comparison"
15
14
  require "snap_diff/legacy_shims"
15
+
16
+ # Deliberately EAGER and silent (v2 step 6 exception): Comparison is a
17
+ # documented user-facing struct, so adopters feature-detect it with
18
+ # defined?/const_defined? -- neither of which triggers const_missing, so a
19
+ # lazy shim reported it permanently absent. See snap_diff/legacy_shims.rb
20
+ # for the full exception list.
21
+ module Capybara
22
+ module Screenshot
23
+ module Diff
24
+ Comparison = SnapDiff::Comparison::Images
25
+ end
26
+ end
27
+ end
@@ -1,7 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Forwarder (ADR-008 step 4): the default reporter lives at
4
- # SnapDiff::Reporters::Default; the old name now resolves lazily via
5
- # snap_diff/legacy_shims' const_missing, with a deprecation warning.
4
+ # SnapDiff::Reporters::Default.
6
5
  require "snap_diff/reporters/default"
7
6
  require "snap_diff/legacy_shims"
7
+
8
+ # Deliberately EAGER and silent (v2 step 6 exception): Default is a
9
+ # documented subclassing extension point, so adopters feature-detect it with
10
+ # defined?/const_defined? -- neither of which triggers const_missing, so a
11
+ # lazy shim reported it permanently absent. See snap_diff/legacy_shims.rb
12
+ # for the full exception list.
13
+ module Capybara
14
+ module Screenshot
15
+ module Diff
16
+ module Reporters
17
+ Default = SnapDiff::Reporters::Default
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Legacy entry point: loads the legacy surface (the umbrella) like its
4
+ # minitest/rspec/cucumber siblings, so consumers who require only this file
5
+ # still get CapybaraScreenshotDiff's session and reporter methods.
6
+ require "capybara_screenshot_diff"
3
7
  require "snap_diff/static"
4
8
 
5
9
  module CapybaraScreenshotDiff
data/lib/snap_diff/dsl.rb CHANGED
@@ -1,5 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # The canonical entry point. Everything a user is told to require under
4
+ # snap_diff/ (this file, snap_diff/integrations/*, snap_diff/static) routes
5
+ # through here, so this one line is what makes SnapDiff.configure/.start/
6
+ # .compare/::VERSION -- and the dual-install guard -- present no matter
7
+ # which of those paths the user picked. snap_diff.rb never requires this
8
+ # file back, so the require graph stays acyclic.
9
+ require "snap_diff"
10
+
3
11
  # No require of "capybara_screenshot_diff" here: every Capybara::Screenshot
4
12
  # reference below is inside a method body, resolved lazily at call time, not
5
13
  # at this file's own load time -- so this unit has no eager dependency on
@@ -8,6 +8,12 @@ require "snap_diff/error_with_filtered_backtrace"
8
8
  # shims, because rescue clauses and defined?/const_defined? feature
9
9
  # detection in adopter code must keep behaving exactly as before
10
10
  # (const_defined? never triggers const_missing).
11
+ #
12
+ # Error is the catch-all docs/snapdiff.md advertises: EVERY error this gem
13
+ # raises inherits it, so `rescue SnapDiff::Error` really does catch them all
14
+ # (pinned by test/unit/errors_alias_test.rb, which discovers the classes
15
+ # rather than listing them). ErrorWithFilteredBacktrace is plumbing, not a
16
+ # second root.
11
17
  module SnapDiff
12
18
  class Error < ErrorWithFilteredBacktrace; end
13
19
 
@@ -15,5 +21,5 @@ module SnapDiff
15
21
 
16
22
  class UnstableImage < Error; end
17
23
 
18
- class WindowSizeMismatchError < ErrorWithFilteredBacktrace; end
24
+ class WindowSizeMismatchError < Error; end
19
25
  end
@@ -20,6 +20,11 @@ require "snap_diff/drivers"
20
20
  # const_missing, so a lazy shim would break that contract.
21
21
  # - Capybara::Screenshot::Diff::VERSION: the gemspec resolves it at build
22
22
  # time; a lazy shim would make every `gem build` warn.
23
+ # - Capybara::Screenshot::Diff::Reporters::Default (a documented subclassing
24
+ # extension point) and Capybara::Screenshot::Diff::Comparison (the images
25
+ # struct): documented user-facing names that adopters feature-detect with
26
+ # defined?/const_defined?. Assigned eagerly by their own forwarder files
27
+ # (reporters/default.rb, image_compare.rb).
23
28
  # - Drivers::ChunkyPNGDriver / Drivers::VipsDriver: real constants on the
24
29
  # shared SnapDiff::Drivers module (the Drivers alias is same-object by
25
30
  # contract), so const_missing can never fire for the leaf names;
@@ -57,9 +62,6 @@ module Capybara
57
62
  module Diff
58
63
  # EAGER same-object alias of the canonical driver cache (see header).
59
64
  LOADED_DRIVERS = SnapDiff::Drivers.loaded
60
-
61
- module Reporters
62
- end
63
65
  end
64
66
  end
65
67
  end
@@ -84,14 +86,9 @@ SnapDiff::LegacyShims.install(Capybara::Screenshot::Diff, "Capybara::Screenshot:
84
86
  ScreenshotMatcher: "SnapDiff::ScreenshotMatcher",
85
87
  Drivers: "SnapDiff::Drivers",
86
88
  ImageCompare: "SnapDiff::Comparison",
87
- Comparison: "SnapDiff::Comparison::Images",
88
89
  Difference: "SnapDiff::ComparisonResult"
89
90
  }.freeze)
90
91
 
91
- SnapDiff::LegacyShims.install(Capybara::Screenshot::Diff::Reporters, "Capybara::Screenshot::Diff::Reporters", {
92
- Default: "SnapDiff::Reporters::Default"
93
- }.freeze)
94
-
95
92
  SnapDiff::LegacyShims.install(CapybaraScreenshotDiff, "CapybaraScreenshotDiff", {
96
93
  RED_RGBA: "SnapDiff::RED_RGBA",
97
94
  ORANGE_RGBA: "SnapDiff::ORANGE_RGBA",
@@ -40,7 +40,7 @@ module SnapDiff
40
40
  reporters_snapshot.each do |reporter|
41
41
  reporter.record(assertions)
42
42
  rescue => e
43
- warn "[capybara-screenshot-diff] Reporter failed: #{e.message}"
43
+ warn "[snap_diff] Reporter #{reporter.class} failed (#{e.class}: #{e.message})"
44
44
  end
45
45
  end
46
46
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SnapDiff
4
- VERSION = "2.0.0.beta2"
4
+ VERSION = "2.0.0.beta3"
5
5
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Bundler.require entry point for `gem "snap_diff-capybara"`: Bundler
4
+ # requires the gem's own name, and its dash->slash fallback ("snap_diff/
5
+ # capybara") misses too, so without this file a Rails user gets a silent
6
+ # no-op and a confusing NameError later. Loads what the sibling
7
+ # capybara-screenshot-diff.rb loads.
8
+ require "capybara_screenshot_diff/minitest"
data/lib/snap_diff.rb CHANGED
@@ -6,8 +6,14 @@
6
6
  # undetectable. Refuse that setup at the entry point. Local dev from
7
7
  # source loads neither spec, so the guard fires only when both are
8
8
  # genuinely installed as gems.
9
+ #
10
+ # snap_diff/errors is pulled in first (two dependency-free files) so
11
+ # DualInstallError can sit under SnapDiff::Error like every other error the
12
+ # gem raises -- docs/snapdiff.md promises Error is the catch-all.
13
+ require "snap_diff/errors"
14
+
9
15
  module SnapDiff
10
- DualInstallError = Class.new(StandardError)
16
+ DualInstallError = Class.new(Error)
11
17
 
12
18
  # @api private
13
19
  def self.assert_single_gem!(loaded_specs = Gem.loaded_specs)
@@ -40,8 +46,13 @@ SnapDiff.assert_single_gem!
40
46
  require "capybara/dsl"
41
47
  require "capybara/screenshot/diff/config_legacy"
42
48
  require "capybara/screenshot/diff/image_compare"
43
- require "snap_diff/errors"
44
49
  require "snap_diff/config"
50
+ require "snap_diff/version"
51
+ # SnapDiff.session/.reset/.pending_screenshots_message are part of the
52
+ # documented core surface (docs/snapdiff.md object map lists them with no
53
+ # extra require), so the entry point owns them rather than leaving them to
54
+ # whichever integration happens to be loaded.
55
+ require "snap_diff/screenshot_assertion"
45
56
 
46
57
  # Forward-looking namespace for the gem, per ADR-004.
47
58
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snap_diff-capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta2
4
+ version: 2.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
@@ -133,6 +133,7 @@ files:
133
133
  - lib/capybara_screenshot_diff/snap.rb
134
134
  - lib/capybara_screenshot_diff/snap_manager.rb
135
135
  - lib/capybara_screenshot_diff/static.rb
136
+ - lib/snap_diff-capybara.rb
136
137
  - lib/snap_diff.rb
137
138
  - lib/snap_diff/annotation_service.rb
138
139
  - lib/snap_diff/area_calculator.rb