Skip to content

Commit

Permalink
Only include Turbo::Broadcastable::TestHelper with Action Cable (#574)
Browse files Browse the repository at this point in the history
Closes [#573][]
Related to [#565][]

Re-structure the automatic inclusion of the
`Turbo::Broadcastable::TestHelper` module so that it's only
automatically loaded and installed when Action Cable is available to the
runtime.

[#573]: hotwired/turbo-rails#573
[#565]: hotwired/turbo-rails#565 (comment)
  • Loading branch information
newheaven918 committed Feb 9, 2024
1 parent 9b7aef8 commit a633a00
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/turbo/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,14 @@ class Engine < Rails::Engine
initializer "turbo.test_assertions" do
ActiveSupport.on_load(:active_support_test_case) do
require "turbo/test_assertions"
require "turbo/broadcastable/test_helper"

include Turbo::TestAssertions
include Turbo::Broadcastable::TestHelper
end

ActiveSupport.on_load(:action_cable) do
ActiveSupport.on_load(:active_support_test_case) do
require "turbo/broadcastable/test_helper"
include Turbo::Broadcastable::TestHelper
end
end

ActiveSupport.on_load(:action_dispatch_integration_test) do
Expand Down

0 comments on commit a633a00

Please sign in to comment.