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

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

Instance Method Summary collapse

Instance Method Details

#channel_classObject



210
211
212
213
214
215
216
# File 'lib/action_cable/channel/test_case.rb', line 210

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

#determine_default_channel(name) ⇒ Object



218
219
220
221
222
223
224
# File 'lib/action_cable/channel/test_case.rb', line 218

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) ⇒ Object



199
200
201
202
203
204
205
206
207
208
# File 'lib/action_cable/channel/test_case.rb', line 199

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