module AbstractController::Helpers::ClassMethods

def define_helpers_module(klass, helpers = nil)

def define_helpers_module(klass, helpers = nil)
  # In some tests inherited is called explicitly. In that case, just
  # return the module from the first time it was defined
  return klass.const_get(:HelperMethods) if klass.const_defined?(:HelperMethods, false)
  mod = Module.new
  klass.const_set(:HelperMethods, mod)
  mod.include(helpers) if helpers
  mod
end