Test
adapter for Action CableThe 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.
# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 17 def broadcast(channel, payload) broadcasts(channel) << payload super end
# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 22 def broadcasts(channel) channels_data[channel] ||= [] end
# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 30 def clear @channels_data = nil end
# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 26 def clear_messages(channel) channels_data[channel] = [] end
© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.