module ActionView::TestCase::Behavior::ClassMethods - actionview-4.2.3 Documentation

# module ActionView::TestCase::Behavior::ClassMethods

### Attributes

helper_class[W]

### Public Instance Methods

determine_default_helper_class(name) click to toggle source

    # File lib/action_view/test_case.rb, line 65
    def determine_default_helper_class(name)
      determine_constant_from_test_name(name) do |constant|
        Module === constant && !(Class === constant)
      end
    end

helper_class() click to toggle source

    # File lib/action_view/test_case.rb, line 84
    def helper_class
      @helper_class ||= determine_default_helper_class(name)
    end

helper_method(*methods) click to toggle source

    # File lib/action_view/test_case.rb, line 71
    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(*) click to toggle source
Calls superclass method

    # File lib/action_view/test_case.rb, line 88
    def new(*)
      include_helper_modules!
      super
    end

tests(helper_class) click to toggle source

    # File lib/action_view/test_case.rb, line 56
    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

### Private Instance Methods

include_helper_modules!() click to toggle source

    # File lib/action_view/test_case.rb, line 95
    def include_helper_modules!
      helper(helper_class) if helper_class
      include _helpers
    end