Skip to Content Skip to Search

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::SubscriptionAdapter::Async adapter, so it could be used in system tests too.

Methods
B
C

Instance Public methods

broadcast(channel, payload)

# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 15
def broadcast(channel, payload)
  broadcasts(channel) << payload
  super
end

broadcasts(channel)

# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 20
def broadcasts(channel)
  channels_data[channel] ||= []
end

clear()

# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 28
def clear
  @channels_data = nil
end

clear_messages(channel)

# File actioncable/lib/action_cable/subscription_adapter/test.rb, line 24
def clear_messages(channel)
  channels_data[channel] = []
end