123456789_123456789_123456789_123456789_123456789_

Class: ActionCable::SubscriptionAdapter::Test

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Async, Inline, Base
Instance Chain:
self, Async, Inline, 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 Async adapter, so it could be used in system tests too.

Class Method Summary

Inline - Inherited

Base - Inherited

Instance Attribute Summary

Base - Inherited

Instance Method Summary

Constructor Details

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

Instance Method Details

#broadcast(channel, payload)

[ GitHub ]

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

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

#broadcasts(channel)

[ GitHub ]

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

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

#channels_data (private)

[ GitHub ]

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

def channels_data
  @channels_data ||= {}
end

#clear

[ GitHub ]

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

def clear
  @channels_data = nil
end

#clear_messages(channel)

[ GitHub ]

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

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