Module: ActionCable::Connection::TestCase::Behavior
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
::ActiveSupport::Concern
|
|
|
Instance Chain:
|
|
| Defined in: | actioncable/lib/action_cable/connection/test_case.rb |
Constant Summary
-
DEFAULT_PATH =
# File 'actioncable/lib/action_cable/connection/test_case.rb', line 244"/cable"
Class Method Summary
::ActiveSupport::Concern - Extended
| class_methods | Define class methods from given block. |
| included | Evaluate given block in context of base class, so that you can write class macros here. |
| prepended | Evaluate given block in context of base class, so that you can write class macros here. |
| append_features, prepend_features | |
Instance Attribute Summary
- #connection readonly
- #socket readonly
- #testserver readonly
Instance Method Summary
-
#connect(path = ActionCable.server.config.mount_path, server: ActionCable.server, **request_params)
Performs connection attempt to exert #connect on the connection under test.
- #cookies
-
#disconnect
Exert #disconnect on the connection under test.
- #transmissions
::ActionCable::Connection::Assertions - Included
| #assert_reject_connection | Asserts that the connection is rejected (via |
DSL Calls
included
[ GitHub ]249 250 251 252 253
# File 'actioncable/lib/action_cable/connection/test_case.rb', line 249
included do class_attribute :_connection_class ActiveSupport.run_load_hooks(:action_cable_connection_test_case, self) end
Instance Attribute Details
#connection (readonly)
[ GitHub ]# File 'actioncable/lib/action_cable/connection/test_case.rb', line 284
attr_reader :connection, :socket, :testserver
#socket (readonly)
[ GitHub ]# File 'actioncable/lib/action_cable/connection/test_case.rb', line 284
attr_reader :connection, :socket, :testserver
#testserver (readonly)
[ GitHub ]# File 'actioncable/lib/action_cable/connection/test_case.rb', line 284
attr_reader :connection, :socket, :testserver
Instance Method Details
#connect(path = ActionCable.server.config.mount_path, server: ActionCable.server, **request_params)
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
::Rackenv configuration (Hash)
# File 'actioncable/lib/action_cable/connection/test_case.rb', line 294
def connect(path = ActionCable.server.config.mount_path, server: ActionCable.server, **request_params) path ||= DEFAULT_PATH @socket = TestSocket.new(TestSocket.build_request(path, **request_params, cookies: )) @testserver = Connection::TestServer.new(server) connection = self.class.connection_class.new(@testserver, socket) connection.connect if connection.respond_to?(:connect) # Only set instance variable if connected successfully @connection = connection end
#cookies
[ GitHub ]# File 'actioncable/lib/action_cable/connection/test_case.rb', line 314
def @cookie_jar ||= TestCookieJar.new end
#disconnect
Exert #disconnect on the connection under test.
# File 'actioncable/lib/action_cable/connection/test_case.rb', line 307
def disconnect raise "Must be connected!" if connection.nil? connection.disconnect if connection.respond_to?(:disconnect) @connection = nil end
#transmissions
[ GitHub ]# File 'actioncable/lib/action_cable/connection/test_case.rb', line 318
def transmissions socket&.transmissions || [] end