Skip to content

Commit

Permalink
Only include Turbo::Broadcastable::TestHelper with Action Cable
Browse files Browse the repository at this point in the history
Closes [hotwired#573][]
Related to [hotwired#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.

[hotwired#573]: hotwired#573
[hotwired#565]: hotwired#565 (comment)
  • Loading branch information
seanpdoyle committed Feb 9, 2024
1 parent 1ebc46c commit f41a90d
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 f41a90d

Please sign in to comment.