123456789_123456789_123456789_123456789_123456789_

Class: ActionCable::SubscriptionAdapter::Test

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Base
Instance Chain:
self, Base
Inherits: ActionCable::SubscriptionAdapter::Async
Defined in: actioncable/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 config/cable.yml file.

NOTE: Test adapter extends the ActionCable::SubscriptionsAdapter::Async adapter, so it could be used in system tests too.

Class Method Summary

Base - Inherited

Instance Attribute Summary

Base - Inherited

Instance Method Summary

Constructor Details

This class inherits a constructor from ActionCable::SubscriptionAdapter::Base

Instance Method Details

#broadcast(channel, payload)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/subscription_adapter/test.rb', line 17

def broadcast(channel, payload)
  broadcasts(channel) << payload
  super
end

#broadcasts(channel)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/subscription_adapter/test.rb', line 22

def broadcasts(channel)
  channels_data[channel] ||= []
end

#clear

[ GitHub ]

  
# File 'actioncable/lib/action_cable/subscription_adapter/test.rb', line 30

def clear
  @channels_data = nil
end

#clear_messages(channel)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/subscription_adapter/test.rb', line 26

def clear_messages(channel)
  channels_data[channel] = []
end