instance method
tests
Ruby on Rails 6.1.7.10
Since v3.0.20Signature
tests(controller_class)
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'
Parameters
-
controller_classreq
Source
# File actionpack/lib/action_controller/test_case.rb, line 347
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
Defined in actionpack/lib/action_controller/test_case.rb line 347
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::TestCase::Behavior::ClassMethods