class ActionCable::StreamTests::StreamFromTest

Private Instance Methods

open_connection() click to toggle source
# File actioncable/test/channel/stream_test.rb, line 190
def open_connection
  env = Rack::MockRequest.env_for "/test", "HTTP_HOST" => "localhost", "HTTP_CONNECTION" => "upgrade", "HTTP_UPGRADE" => "websocket", "HTTP_ORIGIN" => "http://rubyonquails.com"

  Connection.new(@server, env).tap do |connection|
    connection.process
    assert connection.websocket.possible?

    wait_for_async
    assert connection.websocket.alive?
  end
end
receive(connection, command:, identifiers:, channel: "ActionCable::StreamTests::ChatChannel") click to toggle source
# File actioncable/test/channel/stream_test.rb, line 202
def receive(connection, command:, identifiers:, channel: "ActionCable::StreamTests::ChatChannel")
  identifier = JSON.generate(channel: channel, **identifiers)
  connection.dispatch_websocket_message JSON.generate(command: command, identifier: identifier)
  wait_for_async
end
subscribe_to(connection, identifiers:) click to toggle source
# File actioncable/test/channel/stream_test.rb, line 186
def subscribe_to(connection, identifiers:)
  receive connection, command: "subscribe", identifiers: identifiers
end