123456789_123456789_123456789_123456789_123456789_

Class: ActionCable::Channel::ConnectionStub

Relationships & Source Files
Inherits: Object
Defined in: actioncable/lib/action_cable/channel/test_case.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(identifiers = {}) ⇒ ConnectionStub

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 55

def initialize(identifiers = {})
  @server = ActionCable.server
  @transmissions = []

  identifiers.each do |identifier, val|
    define_singleton_method(identifier) { val }
  end

  @subscriptions = ActionCable::Connection::Subscriptions.new(self)
  @identifiers = identifiers.keys
  @logger = ActiveSupport::TaggedLogging.new ActiveSupport::Logger.new(StringIO.new)
end

Instance Attribute Details

#config (readonly)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 53

delegate :pubsub, :config, to: :server

#identifiers (readonly)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 51

attr_reader :server, :transmissions, :identifiers, :subscriptions, :logger

#logger (readonly)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 51

attr_reader :server, :transmissions, :identifiers, :subscriptions, :logger

#pubsub (readonly)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 53

delegate :pubsub, :config, to: :server

#server (readonly)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 51

attr_reader :server, :transmissions, :identifiers, :subscriptions, :logger

#subscriptions (readonly)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 51

attr_reader :server, :transmissions, :identifiers, :subscriptions, :logger

#transmissions (readonly)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 51

attr_reader :server, :transmissions, :identifiers, :subscriptions, :logger

Instance Method Details

#connection_gid(ids) (private)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 77

def connection_gid(ids)
  ids.map do |o|
    if o.respond_to?(:to_gid_param)
      o.to_gid_param
    else
      o.to_s
    end
  end.sort.join(":")
end

#connection_identifier

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 72

def connection_identifier
  @connection_identifier ||= connection_gid(identifiers.filter_map { |id| send(id.to_sym) if id })
end

#transmit(cable_message)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 68

def transmit(cable_message)
  transmissions << cable_message.with_indifferent_access
end