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
Instance Method Details
permalink #determine_default_helper_class(name) ⇒ Object
[View source]
61 62 63 64 65 66 |
# File 'actionpack/lib/action_view/test_case.rb', line 61 def determine_default_helper_class(name) mod = name.sub(/Test$/, '').constantize mod.is_a?(Class) ? nil : mod rescue NameError nil end |
permalink #helper_method(*methods) ⇒ Object
[View source]
68 69 70 71 72 73 74 75 76 77 |
# File 'actionpack/lib/action_view/test_case.rb', line 68 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 |
permalink #new ⇒ Object
[View source]
85 86 87 88 |
# File 'actionpack/lib/action_view/test_case.rb', line 85 def new(*) include_helper_modules! super end |
permalink #tests(helper_class) ⇒ Object
[View source]
52 53 54 55 56 57 58 59 |
# File 'actionpack/lib/action_view/test_case.rb', line 52 def tests(helper_class) case helper_class when String, Symbol self.helper_class = "#{helper_class.to_s.underscore}_helper".camelize.safe_constantize when Module self.helper_class = helper_class end end |