Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/helpers/stub_feature_flags.rb')
-rw-r--r--spec/support/helpers/stub_feature_flags.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/support/helpers/stub_feature_flags.rb b/spec/support/helpers/stub_feature_flags.rb
index 77f31169ecb..f1654e55b7e 100644
--- a/spec/support/helpers/stub_feature_flags.rb
+++ b/spec/support/helpers/stub_feature_flags.rb
@@ -70,4 +70,18 @@ module StubFeatureFlags
def skip_default_enabled_yaml_check
allow(Feature::Definition).to receive(:default_enabled?).and_return(false)
end
+
+ def stub_feature_flag_definition(name, opts = {})
+ opts = opts.with_defaults(
+ name: name,
+ type: 'development',
+ default_enabled: false
+ )
+
+ Feature::Definition.new("#{opts[:type]}/#{name}.yml", opts).tap do |definition|
+ all_definitions = Feature::Definition.definitions
+ all_definitions[definition.key] = definition
+ allow(Feature::Definition).to receive(:definitions).and_return(all_definitions)
+ end
+ end
end