Skip to content

Commit 5d0e075

Browse files
Add support for rendering turbo stream tags (#1227)
* Add failing test for rendering turbo stream tags * Skip Turbo test on Rails < 6 * Use Appraisal to only load turbo-rails for compatible versions * Don't error if turbo-rails is required on an unsupported Rails version * Add turbo-rails for rails-7.1 appraisal, regenerate lockfiles * Re-add `end` tag that went missing in the rebase * Make test pass and document * Verify capture compatibility patch fixes this * Require action_cable to navigate hotwired/turbo-rails#74 * Lint * Remove lingering Rails 5.2/6.0 support * Update docs/CHANGELOG.md --------- Co-authored-by: Joel Hawksley <[email protected]>
1 parent 55306bc commit 5d0e075

16 files changed

+50
-106
lines changed

Appraisals

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ appraise "rails-6.1" do
88
gem "net-smtp", require: false
99
gem "net-imap", require: false
1010
gem "net-pop", require: false
11+
gem "turbo-rails", "~> 1"
1112
end
1213

1314
appraise "rails-7.0" do
1415
gem "rails", "~> 7.0"
1516
gem "tailwindcss-rails", "~> 2.0"
17+
gem "turbo-rails", "~> 1"
1618
end
1719

1820
appraise "rails-7.1" do
1921
gem "rails", "~> 7.1"
2022
gem "tailwindcss-rails", "~> 2.0"
23+
gem "turbo-rails", "~> 1"
2124
end
2225

2326
appraise "rails-7.2" do
@@ -28,4 +31,5 @@ end
2831
appraise "rails-main" do
2932
gem "rails", github: "rails/rails", branch: "main"
3033
gem "tailwindcss-rails", "~> 2.0"
34+
gem "turbo-rails", "~> 1"
3135
end

Gemfile.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ GEM
308308
thor (1.3.1)
309309
tilt (2.4.0)
310310
timeout (0.4.1)
311+
turbo-rails (1.5.0)
312+
actionpack (>= 6.0.0)
313+
activejob (>= 6.0.0)
314+
railties (>= 6.0.0)
311315
tzinfo (2.0.6)
312316
concurrent-ruby (~> 1.0)
313317
unicode-display_width (2.5.0)
@@ -355,6 +359,7 @@ DEPENDENCIES
355359
slim (~> 5.1)
356360
sprockets-rails (~> 3.4.2)
357361
standard (~> 1)
362+
turbo-rails (~> 1)
358363
view_component!
359364
warning
360365
yard (~> 0.9.34)

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ nav_order: 5
1010

1111
## main
1212

13+
* Add test coverage for use of `turbo_stream` helpers in components when `capture_compatibility_patch_enabled` is `true`.
14+
15+
*Simon Fish*
16+
1317
* Add experimental `SlotableDefault` module, allowing components to define a `default_SLOTNAME` method to provide a default value for slots.
1418

1519
*Joel Hawksley*

gemfiles/rails_5.2.gemfile

Lines changed: 0 additions & 19 deletions
This file was deleted.

gemfiles/rails_6.0.gemfile

Lines changed: 0 additions & 20 deletions
This file was deleted.

gemfiles/rails_6.1.gemfile

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,11 @@
22

33
source "https://rubygems.org"
44

5-
gem "capybara", "~> 3"
65
gem "rails", "~> 6.1"
7-
gem "rspec-rails", "~> 5"
6+
gem "tailwindcss-rails", "~> 2.0"
7+
gem "net-smtp", require: false
88
gem "net-imap", require: false
99
gem "net-pop", require: false
10-
gem "net-smtp", require: false
11-
gem "debug"
12-
gem "tailwindcss-rails", "~> 2.0"
13-
14-
group :test do
15-
gem "cuprite", "~> 0.15"
16-
gem "puma", "~> 6"
17-
gem "warning"
18-
gem "selenium-webdriver", "4.9.0"
19-
end
20-
21-
group :development, :test do
22-
gem "appraisal", "~> 2.5"
23-
end
10+
gem "turbo-rails", "~> 1"
2411

2512
gemspec path: "../"

gemfiles/rails_7.0.gemfile

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,8 @@
22

33
source "https://rubygems.org"
44

5-
gem "capybara", "~> 3"
65
gem "rails", "~> 7.0"
7-
gem "rspec-rails", "~> 5"
8-
gem "net-imap", require: false
9-
gem "net-pop", require: false
10-
gem "net-smtp", require: false
11-
gem "debug"
126
gem "tailwindcss-rails", "~> 2.0"
13-
14-
group :test do
15-
gem "cuprite", "~> 0.15"
16-
gem "puma", "~> 6"
17-
gem "warning"
18-
gem "selenium-webdriver", "4.9.0"
19-
end
20-
21-
group :development, :test do
22-
gem "appraisal", "~> 2.5"
23-
end
7+
gem "turbo-rails", "~> 1"
248

259
gemspec path: "../"

gemfiles/rails_7.1.gemfile

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,8 @@
22

33
source "https://rubygems.org"
44

5-
gem "capybara", "~> 3"
65
gem "rails", "~> 7.1"
7-
gem "rspec-rails", "~> 5"
8-
gem "net-imap", require: false
9-
gem "net-pop", require: false
10-
gem "net-smtp", require: false
11-
gem "debug"
126
gem "tailwindcss-rails", "~> 2.0"
13-
14-
group :test do
15-
gem "cuprite", "~> 0.15"
16-
gem "puma", "~> 6"
17-
gem "warning"
18-
gem "selenium-webdriver", "4.9.0"
19-
end
20-
21-
group :development, :test do
22-
gem "appraisal", "~> 2.5"
23-
end
7+
gem "turbo-rails", "~> 1"
248

259
gemspec path: "../"

gemfiles/rails_main.gemfile

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,8 @@
22

33
source "https://rubygems.org"
44

5-
gem "capybara", "~> 3"
65
gem "rails", github: "rails/rails", branch: "main"
7-
gem "rspec-rails", "~> 5"
8-
gem "net-imap", require: false
9-
gem "net-pop", require: false
10-
gem "net-smtp", require: false
11-
gem "debug"
126
gem "tailwindcss-rails", "~> 2.0"
13-
14-
group :test do
15-
gem "cuprite", "~> 0.15"
16-
gem "puma", "~> 6"
17-
gem "warning"
18-
gem "selenium-webdriver", "4.9.0"
19-
end
20-
21-
group :development, :test do
22-
gem "appraisal", "~> 2.5"
23-
end
7+
gem "turbo-rails", "~> 1"
248

259
gemspec path: "../"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= helpers.turbo_stream.update 'area1' do %><span>Hello, world!</span><% end %>

0 commit comments

Comments
 (0)