Module: ActionCable::Connection::TestCase::Behavior::ClassMethods

Defined in:
lib/action_cable/connection/test_case.rb

Instance Method Summary collapse

Instance Method Details

#connection_classObject



235
236
237
238
239
240
241
# File 'lib/action_cable/connection/test_case.rb', line 235

def connection_class
  if connection = self._connection_class
    connection
  else
    tests determine_default_connection(name)
  end
end

#determine_default_connection(name) ⇒ Object



243
244
245
246
247
248
249
# File 'lib/action_cable/connection/test_case.rb', line 243

def determine_default_connection(name)
  connection = determine_constant_from_test_name(name) do |constant|
    Class === constant && constant < ActionCable::Connection::Base
  end
  raise NonInferrableConnectionError.new(name) if connection.nil?
  connection
end

#tests(connection) ⇒ Object



224
225
226
227
228
229
230
231
232
233
# File 'lib/action_cable/connection/test_case.rb', line 224

def tests(connection)
  case connection
  when String, Symbol
    self._connection_class = connection.to_s.camelize.constantize
  when Module
    self._connection_class = connection
  else
    raise NonInferrableConnectionError.new(connection)
  end
end