module ActionCable::Connection::TestCase::Behavior
Inherits From
-
module
ActiveSupport::
Testing:: ConstantLookup -
module
ActionCable::
Connection:: Assertions
Constants
Attributes
[R] | connection |
Public instance methods
Performs connection attempt to exert connect
on the connection under test.
Accepts request path as the first argument and the following request options:
-
params – URL parameters (Hash)
-
headers – request headers (Hash)
-
session – session data (Hash)
-
env – additional Rack env configuration (Hash)
Source code GitHub
# File actioncable/lib/action_cable/connection/test_case.rb, line 188
def connect(path = ActionCable.server.config.mount_path, **request_params)
path ||= DEFAULT_PATH
connection = self.class.connection_class.allocate
connection.singleton_class.include(TestConnection)
connection.send(:initialize, build_test_request(path, **request_params))
connection.connect if connection.respond_to?(:connect)
# Only set instance variable if connected successfully
@connection = connection
end
Source code GitHub
# File actioncable/lib/action_cable/connection/test_case.rb, line 208
def cookies
@cookie_jar ||= TestCookieJar.new
end
Exert disconnect
on the connection under test.
Source code GitHub
# File actioncable/lib/action_cable/connection/test_case.rb, line 201
def disconnect
raise "Must be connected!" if connection.nil?
connection.disconnect if connection.respond_to?(:disconnect)
@connection = nil
end