Class: ActionCable::SubscriptionAdapter::Test
- Inherits:
-
Base
- Object
- Base
- ActionCable::SubscriptionAdapter::Test
- Defined in:
- lib/action_cable/subscription_adapter/test.rb
Overview
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 cable.yml.
Instance Method Summary collapse
- #broadcast(channel, payload) ⇒ Object
- #broadcasts(channel) ⇒ Object
- #clear ⇒ Object
- #clear_messages(channel) ⇒ Object
Instance Method Details
#broadcast(channel, payload) ⇒ Object
12 13 14 |
# File 'lib/action_cable/subscription_adapter/test.rb', line 12 def broadcast(channel, payload) broadcasts(channel) << payload end |
#broadcasts(channel) ⇒ Object
16 17 18 |
# File 'lib/action_cable/subscription_adapter/test.rb', line 16 def broadcasts(channel) channels_data[channel] ||= [] end |
#clear ⇒ Object
24 25 26 |
# File 'lib/action_cable/subscription_adapter/test.rb', line 24 def clear @channels_data = nil end |
#clear_messages(channel) ⇒ Object
20 21 22 |
# File 'lib/action_cable/subscription_adapter/test.rb', line 20 def (channel) channels_data[channel] = [] end |