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 c5ba89d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/turbo/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ 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

if defined? ActionCable
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 c5ba89d

Please sign in to comment.