Method: ActionController::TestCase::Behavior::ClassMethods#tests

Defined in:
actionpack/lib/action_controller/test_case.rb

#tests(controller_class) ⇒ Object

Sets the controller class name. Useful if the name can’t be inferred from test class. Normalizes controller_class before using.

tests WidgetController
tests :widget
tests 'widget'


386
387
388
389
390
391
392
393
394
395
# File 'actionpack/lib/action_controller/test_case.rb', line 386

def tests(controller_class)
  case controller_class
  when String, Symbol
    self.controller_class = "#{controller_class.to_s.camelize}Controller".constantize
  when Class
    self.controller_class = controller_class
  else
    raise ArgumentError, "controller class must be a String, Symbol, or Class"
  end
end