diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-04 21:08:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-04 21:08:35 +0000 |
commit | a653ddb57e30fc5e40a5b2dbd93eed00d8395533 (patch) | |
tree | a805b2e799e896558556392680761e065fe0a1d6 /spec/support/helpers/stub_feature_flags.rb | |
parent | e15501a5e1f54249434167c0198dab775bdc4a1f (diff) | |
download | gitlab-ce-a653ddb57e30fc5e40a5b2dbd93eed00d8395533.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/helpers/stub_feature_flags.rb')
-rw-r--r-- | spec/support/helpers/stub_feature_flags.rb | 14 |
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 |