instance method
stub_connection
Ruby on Rails edge
Since edgeSignature
stub_connection(server: ActionCable.server, **identifiers)
Set up test connection with the specified identifiers:
class ApplicationCable < ActionCable::Connection::Base
identified_by :user, :token
end
stub_connection(user: users[:john], token: 'my-secret-token')
Parameters
-
serverkey = ActionCable.server -
identifierskeyrest
Source
# File actioncable/lib/action_cable/channel/test_case.rb, line 208
def stub_connection(server: ActionCable.server, **identifiers)
@socket = Connection::TestSocket.new(Connection::TestSocket.build_request(ActionCable.server.config.mount_path || "/cable"))
@testserver = Connection::TestServer.new(server)
@connection = self.class.connection_class.new(testserver, socket).tap do |conn|
identifiers.each do |identifier, val|
conn.public_send("#{identifier}=", val)
end
end
end
Defined in actioncable/lib/action_cable/channel/test_case.rb line 208
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionCable::Channel::ChannelExt::TestCase::Behavior