instance method
connect_turbo_cable_stream_sources
Ruby on Rails 2.0.23
Since v2.0.23 Last seen in v2.0.23Signature
connect_turbo_cable_stream_sources(**options, &block)
Delay until every ‘<turbo-cable-stream-source>` element present in the page is ready to receive broadcasts
test "renders broadcasted Messages" do message = Message.new content: "Hello, from Action Cable" visit "/" click_link "All Messages" message.save! # execute server-side code to broadcast a Message assert_text message.content end
By default, calls to #visit will wait for all ‘<turbo-cable-stream-source>` elements to connect. You can control this by modifying the config.turbo.test_connect_after_actions. For example, to wait after calls to #click_link, add the following to config/environments/test.rb:
# config/environments/test.rb config.turbo.test_connect_after_actions << :click_link
To disable automatic connecting, set the configuration to []:
# config/environments/test.rb config.turbo.test_connect_after_actions = []
Parameters
-
optionskeyrest -
blockblock
Source
# File lib/turbo/system_test_helper.rb, line 28
def connect_turbo_cable_stream_sources(**options, &block)
all(:turbo_cable_stream_source, **options, connected: false, wait: 0).each do |element|
element.assert_matches_selector(:turbo_cable_stream_source, **options, connected: true, &block)
end
end
Defined in lib/turbo/system_test_helper.rb line 28
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Turbo::SystemTestHelper