Commit 916183a7 authored by Yorick Peterse's avatar Yorick Peterse

Add methods for injecting EE modules

This adds the methods prepend_if_ee, extend_if_ee, and include_if_ee
that can be used to inject EE specific modules in EE.

These methods are exposed as an initializer that is loaded as soon as
possible. For tests that use fast_spec_helper.rb we must load this
initializer manually, as the Rails environment is not loaded. This is
not the most pretty setup, but unfortunately there is no alternative
that we can use.
parent 5a221665
# frozen_string_literal: true
module InjectEnterpriseEditionModule
def prepend_if_ee(constant)
prepend(constant.constantize) if Gitlab.ee?
end
def extend_if_ee(constant)
extend(constant.constantize) if Gitlab.ee?
end
def include_if_ee(constant)
include(constant.constantize) if Gitlab.ee?
end
end
Module.prepend(InjectEnterpriseEditionModule)
......@@ -4,6 +4,7 @@ ENV['GITLAB_ENV'] = 'test'
ENV['IN_MEMORY_APPLICATION_SETTINGS'] = 'true'
require 'active_support/dependencies'
require_relative '../config/initializers/0_inject_enterprise_edition_module'
require_relative '../config/settings'
require_relative 'support/rspec'
require 'active_support/all'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment