turbo_rspec 0.4.0 → 0.5.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
  SHA256:
3
- metadata.gz: 9752bc68a0676737d5e31eda8279871c6aa23e09c0cafb6eab046ae153f8a103
4
- data.tar.gz: d6a13d4d95ee05e4fb6221a36aaebc807e367d0a313b9f8e00eaa307138183dc
3
+ metadata.gz: c9273ce0d0b091c73a80681f52986b639412d89b64fff6a8d79f40ce2b742997
4
+ data.tar.gz: 84d380b306f6a75ebc0af9ae8c5beed6c141c0da44ea736706eeb17392c63489
5
5
  SHA512:
6
- metadata.gz: 78309d93bfac9a17816989f570dd287f10ea149bb4781be1a6e514449387862d46cf93cf30914e456bc5d0c88c7585aff998fe62831902688edd0a3081007f86
7
- data.tar.gz: dc224517ae6717151a75f01c45028732949fe06fc65248b20dc17807318a363b1aa96c375c10c2dcbb7ebadab686a3cf4d859105d15b1a00b579c1dba4478f18
6
+ metadata.gz: 3965ea0fe3c731120ffa83a5efc331c1bd420e3271c153f1e3be37c1b62fe5b8243ae3fc20f4a8ab8723403ed0a9dd0aa7f07ad242a864b769e242dd6087a2f1
7
+ data.tar.gz: 82357eebbe233ed14882216b2075f29d1a97e4d0aed68c789a79747da1ac4aaf84a88ef8b8d0273204a9cd81c3f6e2dc5b04d933bca6e16b988e8749538812ff
@@ -39,12 +39,13 @@ jobs:
39
39
  - run: bundle exec bundle-audit check
40
40
 
41
41
  test:
42
- name: Ruby ${{ matrix.ruby }}
42
+ name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
43
43
  runs-on: ubuntu-latest
44
44
  strategy:
45
45
  fail-fast: false
46
46
  matrix:
47
47
  ruby: ["3.3", "3.4", "4.0"]
48
+ rails: ["7.2", "8.0", "8.1"]
48
49
 
49
50
  steps:
50
51
  - uses: actions/checkout@v6
@@ -54,4 +55,6 @@ jobs:
54
55
  ruby-version: ${{ matrix.ruby }}
55
56
  bundler-cache: true
56
57
 
57
- - run: bundle exec rspec
58
+ - run: bundle exec rspec
59
+ env:
60
+ RAILS_VERSION: ${{ matrix.rails }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.0] - 2026-05-28
4
+
5
+ ### Added
6
+
7
+ - `TurboRspec::Assertions` — opt-in minitest companion module with `assert_turbo_stream`, `refute_turbo_stream`, `assert_turbo_frame`, `refute_turbo_frame`; no RSpec dependency required
8
+ - `refresh` and `morph` action support confirmed working via compatibility specs
9
+ - Multi-stream response body parsing confirmed — a single response body with multiple `<turbo-stream>` tags works with all matchers
10
+ - Graceful no-op when `turbo-rails` is not in the Gemfile — no `LoadError`
11
+ - CI Rails matrix: Ruby 3.3/3.4/4.0 × Rails 7.2/8.0/8.1
12
+
3
13
  ## [0.4.0] - 2026-05-28
4
14
 
5
15
  ### Added
data/README.md CHANGED
@@ -250,6 +250,35 @@ RSpec.describe "Messages", type: :system do
250
250
  end
251
251
  ```
252
252
 
253
+ ## Minitest support
254
+
255
+ `TurboRspec::Assertions` is an opt-in companion module with no RSpec dependency. Include it in any Minitest test class:
256
+
257
+ ```ruby
258
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
259
+ include TurboRspec::Assertions
260
+ end
261
+ ```
262
+
263
+ ### Available assertions
264
+
265
+ ```ruby
266
+ # Stream assertions
267
+ assert_turbo_stream(response, action: :append, target: "messages")
268
+ assert_turbo_stream(response, action: :append, target: "messages", content: "Hello")
269
+ assert_turbo_stream(response, targets: ".items")
270
+ assert_turbo_stream(response, partial: "messages/_message")
271
+ refute_turbo_stream(response, action: :replace)
272
+
273
+ # Frame assertions
274
+ assert_turbo_frame(response, id: "messages")
275
+ assert_turbo_frame(response, id: "messages", content: "Hello")
276
+ refute_turbo_frame(response, id: "notifications")
277
+
278
+ # Custom failure message
279
+ assert_turbo_stream(response, action: :append, message: "expected append stream")
280
+ ```
281
+
253
282
  ## Contributing
254
283
 
255
284
  Bug reports and pull requests are welcome on [GitHub](https://github.com/eclectic-coding/turbo_rspec).
data/ROADMAP.md CHANGED
@@ -4,22 +4,6 @@ RSpec matchers for [Turbo](https://github.com/hotwired/turbo-rails): Turbo Strea
4
4
 
5
5
  ---
6
6
 
7
-
8
- ---
9
-
10
- ## v0.5.0 — Compatibility and edge cases
11
-
12
- **Goal:** harden the gem against real-world app variations.
13
-
14
- - Rails 7.2/8.0/8.1 and Turbo 1.x/2.x compatibility matrix in CI (7.1 is EOL)
15
- - Multi-stream response body parsing (a single response can contain multiple `<turbo-stream>` tags)
16
- - `refresh` action support (Turbo 8 page refresh streams)
17
- - `morph` action support (Turbo Morphing)
18
- - Graceful no-op when `turbo-rails` is not in the Gemfile (no `LoadError`)
19
- - Minitest module (`TurboRspec::Assertions`) as opt-in companion (no RSpec dependency for that module)
20
-
21
- ---
22
-
23
7
  ## v0.6.0 — Testing utilities
24
8
 
25
9
  **Goal:** reduce boilerplate in real test suites and close the controller spec gap.
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "matchers/have_turbo_frame"
4
+ require_relative "matchers/have_turbo_stream"
5
+
6
+ module TurboRspec
7
+ # Minitest-compatible assertions. Include in your test class:
8
+ #
9
+ # class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
10
+ # include TurboRspec::Assertions
11
+ # end
12
+ #
13
+ # No RSpec dependency required.
14
+ module Assertions
15
+ def assert_turbo_stream(response_or_body, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil)
16
+ matcher = build_stream_matcher(action: action, target: target, targets: targets, content: content, partial: partial)
17
+ assert matcher.matches?(response_or_body), message || matcher.failure_message
18
+ end
19
+
20
+ def refute_turbo_stream(response_or_body, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil)
21
+ matcher = build_stream_matcher(action: action, target: target, targets: targets, content: content, partial: partial)
22
+ assert matcher.does_not_match?(response_or_body), message || matcher.failure_message_when_negated
23
+ end
24
+
25
+ def assert_turbo_frame(response_or_body, id: nil, content: nil, partial: nil, message: nil)
26
+ matcher = build_frame_matcher(id: id, content: content, partial: partial)
27
+ assert matcher.matches?(response_or_body), message || matcher.failure_message
28
+ end
29
+
30
+ def refute_turbo_frame(response_or_body, id: nil, content: nil, partial: nil, message: nil)
31
+ matcher = build_frame_matcher(id: id, content: content, partial: partial)
32
+ assert matcher.does_not_match?(response_or_body), message || matcher.failure_message_when_negated
33
+ end
34
+
35
+ private
36
+
37
+ def build_stream_matcher(action:, target:, targets:, content:, partial:)
38
+ matcher = Matchers::HaveTurboStream.new
39
+ matcher.with_action(action) if action
40
+ matcher.targeting(target) if target
41
+ matcher.targeting_all(targets) if targets
42
+ matcher.with_content(content) if content
43
+ matcher.rendering(partial) if partial
44
+ matcher
45
+ end
46
+
47
+ def build_frame_matcher(id:, content:, partial:)
48
+ matcher = Matchers::HaveTurboFrame.new
49
+ matcher.with_id(id) if id
50
+ matcher.with_content(content) if content
51
+ matcher.rendering(partial) if partial
52
+ matcher
53
+ end
54
+ end
55
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TurboRspec
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
data/lib/turbo_rspec.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require_relative "turbo_rspec/version"
4
4
  require_relative "turbo_rspec/configuration"
5
5
  require_relative "turbo_rspec/matchers"
6
+ require_relative "turbo_rspec/assertions"
6
7
  require_relative "turbo_rspec/capybara/matchers"
7
8
 
8
9
  module TurboRspec
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo_rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuck Smith
@@ -43,6 +43,7 @@ files:
43
43
  - Rakefile
44
44
  - codecov.yml
45
45
  - lib/turbo_rspec.rb
46
+ - lib/turbo_rspec/assertions.rb
46
47
  - lib/turbo_rspec/capybara/matchers.rb
47
48
  - lib/turbo_rspec/capybara/matchers/have_turbo_frame.rb
48
49
  - lib/turbo_rspec/capybara/matchers/have_turbo_stream_tag.rb