stimulus_spec 0.7.0 → 0.8.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 +4 -4
- data/CHANGELOG.md +11 -1
- data/ROADMAP.md +1 -6
- data/docs/migration_guide.md +84 -0
- data/lib/stimulus_spec/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6b9e26e1184c0d81c9ebcdffd070ab00c4822f76de661fc229178e2989497588
|
|
4
|
+
data.tar.gz: 91e8c98384c15baba42e7bb5022a47eb14756a236ea6f2b340cf85ecc9bb4db7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3bbf987dbddff7265d933f041e11d2e1223bfd923d855c8836721cc3b5379534b8100e099d7e3952cfba280d26feee50f07000aae6910ccf2c3c86c9cc71eac9
|
|
7
|
+
data.tar.gz: 2d9372a0337c758b3f41eee17f6b650b285bc38e109b972017b41befdc2462f9bd0a9ac1adbcf8be1da2e7615c1cdfd1c1bf9c3b0ab3e017b4156ec84a5bbc54
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.8.0] - 2026-06-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `bin/benchmark` script for measuring matcher overhead
|
|
15
|
+
- Version spec enforcing semver format on `StimulusSpec::VERSION`
|
|
16
|
+
- `docs/migration_guide.md` for migrating from turbo_rspec's Stimulus matchers
|
|
17
|
+
- Guiding principles section in README
|
|
18
|
+
|
|
10
19
|
## [0.7.0] - 2026-06-23
|
|
11
20
|
|
|
12
21
|
### Added
|
|
@@ -61,7 +70,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
61
70
|
- `have_stimulus_action(descriptor)` matcher — full descriptor (`~=`) and shorthand without event (`*=`)
|
|
62
71
|
- `have_stimulus_target(controller, target)` matcher — asserts `[data-{controller}-target~="target"]`
|
|
63
72
|
|
|
64
|
-
[Unreleased]: https://github.com/eclectic-coding/stimulus_spec/compare/v0.
|
|
73
|
+
[Unreleased]: https://github.com/eclectic-coding/stimulus_spec/compare/v0.8.0...HEAD
|
|
74
|
+
[0.8.0]: https://github.com/eclectic-coding/stimulus_spec/releases/tag/v0.8.0
|
|
65
75
|
[0.7.0]: https://github.com/eclectic-coding/stimulus_spec/releases/tag/v0.7.0
|
|
66
76
|
[0.6.0]: https://github.com/eclectic-coding/stimulus_spec/releases/tag/v0.6.0
|
|
67
77
|
[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
|
-
|
|
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.
|
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.
|
|
4
|
+
version: 0.8.0
|
|
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
|