Class: ActionCable::Channel::ConnectionStub
- Defined in:
- actioncable/lib/action_cable/channel/test_case.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#identifiers ⇒ Object
readonly
Returns the value of attribute identifiers.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#subscriptions ⇒ Object
readonly
Returns the value of attribute subscriptions.
-
#transmissions ⇒ Object
readonly
Returns the value of attribute transmissions.
Instance Method Summary collapse
- #connection_identifier ⇒ Object
-
#initialize(identifiers = {}) ⇒ ConnectionStub
constructor
A new instance of ConnectionStub.
- #transmit(cable_message) ⇒ Object
Constructor Details
#initialize(identifiers = {}) ⇒ ConnectionStub
Returns a new instance of ConnectionStub.
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 50 def initialize(identifiers = {}) @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) @config = ActionCable::Server::Configuration.new end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config
48 49 50 |
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 48 def config @config end |
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers
48 49 50 |
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 48 def identifiers @identifiers end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger
48 49 50 |
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 48 def logger @logger end |
#subscriptions ⇒ Object (readonly)
Returns the value of attribute subscriptions
48 49 50 |
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 48 def subscriptions @subscriptions end |
#transmissions ⇒ Object (readonly)
Returns the value of attribute transmissions
48 49 50 |
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 48 def transmissions @transmissions end |
Instance Method Details
#connection_identifier ⇒ Object
67 68 69 |
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 67 def connection_identifier @connection_identifier ||= connection_gid(identifiers.filter_map { |id| send(id.to_sym) if id }) end |
#transmit(cable_message) ⇒ Object
63 64 65 |
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 63 def transmit() transmissions << .with_indifferent_access end |