Class: LiveCable::Testing::TestCableConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/live_cable/testing/test_cable_connection.rb

Overview

Stand-in for an ActionCable connection exposing identified_by values (e.g. current_user) to components and their templates.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifiers = {}) ⇒ TestCableConnection

Returns a new instance of TestCableConnection.



11
12
13
14
15
16
17
18
# File 'lib/live_cable/testing/test_cable_connection.rb', line 11

def initialize(identifiers = {})
  identifiers = identifiers.symbolize_keys
  @identifiers = identifiers.keys.to_set

  identifiers.each do |name, value|
    define_singleton_method(name) { value }
  end
end

Instance Attribute Details

#identifiersSet<Symbol> (readonly)

Returns:

  • (Set<Symbol>)


9
10
11
# File 'lib/live_cable/testing/test_cable_connection.rb', line 9

def identifiers
  @identifiers
end