class ActionCable::SubscriptionAdapter::Test
Test adapter for Action Cable¶ ↑
The test adapter should be used only in testing. Along with
ActionCable::TestHelper
it makes a great tool to test your Rails application.
To use the test adapter set adapter
value to test
in your config/cable.yml
file.
NOTE: Test adapter extends the
ActionCable::SubscriptionsAdapter::Async
adapter, so it could
be used in system tests too.
Public Instance Methods
broadcast(channel, payload)
click to toggle source
Calls superclass method
# File lib/action_cable/subscription_adapter/test.rb, line 16 def broadcast(channel, payload) broadcasts(channel) << payload super end
broadcasts(channel)
click to toggle source
# File lib/action_cable/subscription_adapter/test.rb, line 21 def broadcasts(channel) channels_data[channel] ||= [] end
clear()
click to toggle source
# File lib/action_cable/subscription_adapter/test.rb, line 29 def clear @channels_data = nil end
clear_messages(channel)
click to toggle source
# File lib/action_cable/subscription_adapter/test.rb, line 25 def clear_messages(channel) channels_data[channel] = [] end
Private Instance Methods
channels_data()
click to toggle source
# File lib/action_cable/subscription_adapter/test.rb, line 34 def channels_data @channels_data ||= {} end