123456789_123456789_123456789_123456789_123456789_

Module: ActionCable::Channel::TestCase::Behavior::ClassMethods

Relationships & Source Files
Defined in: actioncable/lib/action_cable/channel/test_case.rb

Instance Method Summary

Instance Method Details

#channel_class

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 195

def channel_class
  if channel = self._channel_class
    channel
  else
    tests determine_default_channel(name)
  end
end

#determine_default_channel(name)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 203

def determine_default_channel(name)
  channel = determine_constant_from_test_name(name) do |constant|
    Class === constant && constant < ActionCable::Channel::Base
  end
  raise NonInferrableChannelError.new(name) if channel.nil?
  channel
end

#tests(channel)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/channel/test_case.rb', line 184

def tests(channel)
  case channel
  when String, Symbol
    self._channel_class = channel.to_s.camelize.constantize
  when Module
    self._channel_class = channel
  else
    raise NonInferrableChannelError.new(channel)
  end
end