stimulus_spec 0.7.0 → 0.8.1

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: 31b3ef6e3b0ef09e3f6353d975ee2a65dd7c42dbc4d3be8aa78c7508b88d9ba7
4
- data.tar.gz: 5f79191a5baccfabe6a8502fa8708248dc71efe1ba63d87f816a2c882ad5e941
3
+ metadata.gz: '0912c1fbe8ee121aa811782e445be9524634567f4b19b59e8921c8c8fd196f39'
4
+ data.tar.gz: c4b7149d6711bcfbda89a04d2b7095fd7996dfa8ff4adb95d034b15885ea1c9e
5
5
  SHA512:
6
- metadata.gz: 6b789aa21b411f503223b5c6116507f48168cfd675ea198c4c3a8cf68490754ebcaf0bcdea718c4cf492400cf3df6eba5d0079c41b2e2ce48020165b6b4bb348
7
- data.tar.gz: 97623a443042991da1c942449406f0e92c0b8918d8a9bdbd8b001962c0c238db103d0d2cc9d27a3aff05bd75256d65b593686876fd731f883f8a5c0547af9d0d
6
+ metadata.gz: 0d84919b59c7d2c1bfafde03194f9db337e4cb78fb25f9f65746fa6cf35b839ca495ffa7a57fe577c0c5e93be98c1993f7fe4d572013cc6f988a02b41b70830e
7
+ data.tar.gz: 7d284dc0aba931a47d44b13e5a563372957b1ef063db08284e1fad073247f482b915d694efb561e78670840af09edc02860971b00d3194ed7675348e087ba7a8
data/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.8.1] - 2026-06-30
11
+
12
+ ### Fixed
13
+
14
+ - Guard matcher requires and `RSpec.configure` behind `defined?(RSpec::Core)` so the gem is safe to auto-require in non-test contexts (e.g. asset precompilation). Previously, a partial load of `rspec-expectations` or `rspec-mocks` could define the `RSpec` constant without `RSpec::Core`, causing a `NoMethodError` when `RSpec.configure` was called. Nokogiri is now also only required when RSpec::Core is present.
15
+
16
+ ## [0.8.0] - 2026-06-23
17
+
18
+ ### Added
19
+
20
+ - `bin/benchmark` script for measuring matcher overhead
21
+ - Version spec enforcing semver format on `StimulusSpec::VERSION`
22
+ - `docs/migration_guide.md` for migrating from turbo_rspec's Stimulus matchers
23
+ - Guiding principles section in README
24
+
10
25
  ## [0.7.0] - 2026-06-23
11
26
 
12
27
  ### Added
@@ -61,7 +76,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
61
76
  - `have_stimulus_action(descriptor)` matcher — full descriptor (`~=`) and shorthand without event (`*=`)
62
77
  - `have_stimulus_target(controller, target)` matcher — asserts `[data-{controller}-target~="target"]`
63
78
 
64
- [Unreleased]: https://github.com/eclectic-coding/stimulus_spec/compare/v0.7.0...HEAD
79
+ [Unreleased]: https://github.com/eclectic-coding/stimulus_spec/compare/v0.8.1...HEAD
80
+ [0.8.1]: https://github.com/eclectic-coding/stimulus_spec/releases/tag/v0.8.1
81
+ [0.8.0]: https://github.com/eclectic-coding/stimulus_spec/releases/tag/v0.8.0
65
82
  [0.7.0]: https://github.com/eclectic-coding/stimulus_spec/releases/tag/v0.7.0
66
83
  [0.6.0]: https://github.com/eclectic-coding/stimulus_spec/releases/tag/v0.6.0
67
84
  [0.5.0]: https://github.com/eclectic-coding/stimulus_spec/releases/tag/v0.5.0
data/ROADMAP.md CHANGED
@@ -1,8 +1,3 @@
1
1
  # stimulus_spec Roadmap
2
2
 
3
- ## 1.0.0 — Stable API
4
-
5
- - API freeze — public method signatures are part of the semver contract
6
- - `bin/benchmark` — matcher overhead measurement
7
- - Version spec (semver format enforced)
8
- - `docs/migration_guide.md` — migrating from turbo_rspec's Stimulus matchers to stimulus_spec
3
+ All planned milestones through 0.8.0 have been completed. Gathering user feedback before a 1.0.0 release.
@@ -0,0 +1,84 @@
1
+ # Migrating from turbo_rspec to stimulus_spec
2
+
3
+ [turbo_rspec](https://github.com/eclectic-coding/turbo_rspec) includes basic Stimulus matchers: `have_stimulus_controller`, `have_stimulus_action`, and `have_stimulus_target`. **stimulus_spec** provides the same three matchers plus `have_stimulus_value`, `have_stimulus_class`, `have_stimulus_outlet`, multi-controller assertions, and scoped matching.
4
+
5
+ Both gems can coexist — they use separate namespaces (`TurboRspec::Matchers` vs `StimulusSpec::Matchers`) and won't conflict. You can migrate incrementally.
6
+
7
+ ## Step 1: Add stimulus_spec
8
+
9
+ ```ruby
10
+ # Gemfile
11
+ group :test do
12
+ gem "stimulus_spec"
13
+ end
14
+ ```
15
+
16
+ ```bash
17
+ bundle install
18
+ ```
19
+
20
+ With `stimulus-rails` in your bundle, `stimulus_spec` auto-includes its matchers into request, controller, system, and feature specs. No configuration needed.
21
+
22
+ ## Step 2: Verify existing tests pass
23
+
24
+ Your existing turbo_rspec Stimulus matchers (`TurboRspec::Matchers`) will continue to work alongside `StimulusSpec::Matchers`. Run your test suite to confirm nothing breaks:
25
+
26
+ ```bash
27
+ bundle exec rspec
28
+ ```
29
+
30
+ ## Step 3: Switch namespaces (optional)
31
+
32
+ If you manually include turbo_rspec's Stimulus matchers, update to the stimulus_spec equivalents:
33
+
34
+ ```ruby
35
+ # Before
36
+ config.include TurboRspec::Matchers, type: :request
37
+
38
+ # After
39
+ config.include StimulusSpec::Matchers, type: :request
40
+ config.include StimulusSpec::Capybara::Matchers, type: :system
41
+ ```
42
+
43
+ If you rely on auto-include (the default for both gems), this step is unnecessary — both sets of matchers are already available.
44
+
45
+ ## Step 4: Use new matchers
46
+
47
+ With stimulus_spec installed, you now have access to matchers that turbo_rspec doesn't provide:
48
+
49
+ ```ruby
50
+ # Value assertions
51
+ expect(response).to have_stimulus_value("search", "url", "/results")
52
+
53
+ # CSS class assertions
54
+ expect(response).to have_stimulus_class("search", "loading", "opacity-50")
55
+
56
+ # Outlet assertions
57
+ expect(response).to have_stimulus_outlet("search", "results", "#results-list")
58
+
59
+ # Multi-controller on a single element
60
+ expect(response).to have_stimulus_controller("hello", "clipboard")
61
+
62
+ # Scoped matching
63
+ expect(response).to have_stimulus_controller("search").within(".search-form")
64
+ ```
65
+
66
+ ## Matcher comparison
67
+
68
+ | Matcher | turbo_rspec | stimulus_spec |
69
+ |---|---|---|
70
+ | `have_stimulus_controller` | Single name | Single or multiple names |
71
+ | `have_stimulus_action` | Full or shorthand | Full or shorthand |
72
+ | `have_stimulus_target` | Controller + target | Controller + target |
73
+ | `have_stimulus_value` | — | Existence or equality |
74
+ | `have_stimulus_class` | — | Existence or equality |
75
+ | `have_stimulus_outlet` | — | Existence or selector |
76
+ | `.within(selector)` | — | All matchers |
77
+ | Capybara variants | Controller, action, target | All six matchers |
78
+ | Failure messages | Basic | Shows found values and HTML context |
79
+
80
+ ## Step 5: Remove turbo_rspec Stimulus matchers (optional)
81
+
82
+ If you want to fully consolidate, you can stop including turbo_rspec's Stimulus matchers. turbo_rspec's Turbo-specific matchers (`have_turbo_frame`, `have_turbo_stream`, etc.) are unaffected — only the Stimulus matchers overlap.
83
+
84
+ If you use turbo_rspec solely for Turbo matchers, no changes are needed. Both gems coexist cleanly.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StimulusSpec
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.1"
5
5
  end
data/lib/stimulus_spec.rb CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  require_relative "stimulus_spec/version"
4
4
  require_relative "stimulus_spec/configuration"
5
- require_relative "stimulus_spec/matchers"
6
- require_relative "stimulus_spec/capybara/matchers"
7
5
 
8
6
  # RSpec matchers for testing Stimulus controller wiring in Rails applications.
9
7
  #
@@ -62,7 +60,10 @@ module StimulusSpec
62
60
  end
63
61
 
64
62
  # :nocov:
65
- if defined?(RSpec)
63
+ if defined?(RSpec::Core)
64
+ require_relative "stimulus_spec/matchers"
65
+ require_relative "stimulus_spec/capybara/matchers"
66
+
66
67
  RSpec.configure do |config|
67
68
  StimulusSpec.install_rspec_integration(config)
68
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuck Smith
@@ -45,6 +45,7 @@ files:
45
45
  - Rakefile
46
46
  - codecov.yml
47
47
  - docs/cookbook.md
48
+ - docs/migration_guide.md
48
49
  - lib/stimulus_spec.rb
49
50
  - lib/stimulus_spec/capybara/matchers.rb
50
51
  - lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb