Class: ActionView::TestCase
Defined Under Namespace
Classes: TestController
Constant Summary
collapse
- @@helper_class =
nil
Class Method Summary
collapse
Instance Method Summary
collapse
#dom_class, #dom_id, #partial_path, #plural_class_name, #singular_class_name
#polymorphic_path, #polymorphic_url
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(selector, *args) ⇒ Object
52
53
54
55
56
|
# File 'lib/action_view/test_case.rb', line 52
def method_missing(selector, *args)
controller = TestController.new
return controller.send!(selector, *args) if ActionController::Routing::Routes.named_routes.helpers.include?(selector)
super
end
|
Class Method Details
.determine_default_helper_class(name) ⇒ Object
21
22
23
24
25
|
# File 'lib/action_view/test_case.rb', line 21
def determine_default_helper_class(name)
name.sub(/Test$/, '').constantize
rescue NameError
nil
end
|
.helper_class ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/action_view/test_case.rb', line 13
def helper_class
if current_helper_class = read_inheritable_attribute(:helper_class)
current_helper_class
else
self.helper_class = determine_default_helper_class(name)
end
end
|
.tests(helper_class) ⇒ Object
9
10
11
|
# File 'lib/action_view/test_case.rb', line 9
def tests(helper_class)
self.helper_class = helper_class
end
|
Instance Method Details
#setup_with_helper_class ⇒ Object
36
37
38
39
40
|
# File 'lib/action_view/test_case.rb', line 36
def setup_with_helper_class
if helper_class && !self.class.ancestors.include?(helper_class)
self.class.send(:include, helper_class)
end
end
|