Module: ActionView::TestCase::Behavior::ClassMethods
- Defined in:
- actionpack/lib/action_view/test_case.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #determine_default_helper_class(name) ⇒ Object
- #helper_method(*methods) ⇒ Object
- #new ⇒ Object
- #tests(helper_class) ⇒ Object
Instance Attribute Details
#helper_class ⇒ Object
76 77 78 |
# File 'actionpack/lib/action_view/test_case.rb', line 76 def helper_class @helper_class ||= determine_default_helper_class(name) end |
Instance Method Details
#determine_default_helper_class(name) ⇒ Object
56 57 58 59 60 61 |
# File 'actionpack/lib/action_view/test_case.rb', line 56 def determine_default_helper_class(name) mod = name.sub(/Test$/, '').constantize mod.is_a?(Class) ? nil : mod rescue NameError nil end |
#helper_method(*methods) ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'actionpack/lib/action_view/test_case.rb', line 63 def helper_method(*methods) # Almost a duplicate from ActionController::Helpers methods.flatten.each do |method| _helpers.module_eval <<-end_eval def #{method}(*args, &block) # def current_user(*args, &block) _test_case.send(%(#{method}), *args, &block) # _test_case.send(%(current_user), *args, &block) end # end end_eval end end |
#new ⇒ Object
80 81 82 83 |
# File 'actionpack/lib/action_view/test_case.rb', line 80 def new(*) include_helper_modules! super end |
#tests(helper_class) ⇒ Object
52 53 54 |
# File 'actionpack/lib/action_view/test_case.rb', line 52 def tests(helper_class) self.helper_class = helper_class end |