Module: ActionCable::Channel::TestCase::Behavior::ClassMethods
- Defined in:
- lib/action_cable/channel/test_case.rb
Instance Method Summary collapse
- #channel_class ⇒ Object
- #connection_class ⇒ Object
- #determine_default_channel(name) ⇒ Object
- #tests(channel) ⇒ Object
- #tests_connection(connection) ⇒ Object
Instance Method Details
#channel_class ⇒ Object
161 162 163 164 165 166 167 |
# File 'lib/action_cable/channel/test_case.rb', line 161 def channel_class if channel = self._channel_class channel else tests determine_default_channel(name) end end |
#connection_class ⇒ Object
180 181 182 183 184 185 186 |
# File 'lib/action_cable/channel/test_case.rb', line 180 def connection_class if connection = self._connection_class connection else tests_connection ActionCable.server.config.connection_class.call end end |
#determine_default_channel(name) ⇒ Object
188 189 190 191 192 193 194 |
# File 'lib/action_cable/channel/test_case.rb', line 188 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
150 151 152 153 154 155 156 157 158 159 |
# File 'lib/action_cable/channel/test_case.rb', line 150 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 |
#tests_connection(connection) ⇒ Object
169 170 171 172 173 174 175 176 177 178 |
# File 'lib/action_cable/channel/test_case.rb', line 169 def tests_connection(connection) case connection when String, Symbol self._connection_class = connection.to_s.camelize.constantize when Module self._connection_class = connection else raise Connection::NonInferrableConnectionError.new(connection) end end |