diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-14 15:09:40 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-14 15:09:40 +0000 |
commit | fde3e0435c496af7dc37527f465573abd5657f5a (patch) | |
tree | 378395c009c4e9b40c3c509189531511494539e5 /spec/support_specs | |
parent | 95671fac6e66cd23da4669706a619c1139eb1f14 (diff) | |
download | gitlab-ce-fde3e0435c496af7dc37527f465573abd5657f5a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support_specs')
-rw-r--r-- | spec/support_specs/helpers/stub_feature_flags_spec.rb | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/spec/support_specs/helpers/stub_feature_flags_spec.rb b/spec/support_specs/helpers/stub_feature_flags_spec.rb index 57dd3015f5e..8629e895fd1 100644 --- a/spec/support_specs/helpers/stub_feature_flags_spec.rb +++ b/spec/support_specs/helpers/stub_feature_flags_spec.rb @@ -5,19 +5,20 @@ require 'spec_helper' RSpec.describe StubFeatureFlags do let_it_be(:dummy_feature_flag) { :dummy_feature_flag } - # We inject dummy feature flag defintion - # to ensure that we strong validate it's usage - # as well - before(:all) do - definition = Feature::Definition.new( + let_it_be(:dummy_definition) do + Feature::Definition.new( nil, name: dummy_feature_flag, type: 'development', - # we allow ambigious usage of `default_enabled:` - default_enabled: [false, true] + default_enabled: false ) + end - Feature::Definition.definitions[dummy_feature_flag] = definition + # We inject dummy feature flag defintion + # to ensure that we strong validate it's usage + # as well + before(:all) do + Feature::Definition.definitions[dummy_feature_flag] = dummy_definition end after(:all) do @@ -47,6 +48,10 @@ RSpec.describe StubFeatureFlags do it { expect(Feature.disabled?(feature_name)).not_to eq(expected_result) } context 'default_enabled does not impact feature state' do + before do + allow(dummy_definition).to receive(:default_enabled).and_return(true) + end + it { expect(Feature.enabled?(feature_name, default_enabled: true)).to eq(expected_result) } it { expect(Feature.disabled?(feature_name, default_enabled: true)).not_to eq(expected_result) } end @@ -79,6 +84,10 @@ RSpec.describe StubFeatureFlags do it { expect(Feature.disabled?(feature_name, actor(tested_actor))).not_to eq(expected_result) } context 'default_enabled does not impact feature state' do + before do + allow(dummy_definition).to receive(:default_enabled).and_return(true) + end + it { expect(Feature.enabled?(feature_name, actor(tested_actor), default_enabled: true)).to eq(expected_result) } it { expect(Feature.disabled?(feature_name, actor(tested_actor), default_enabled: true)).not_to eq(expected_result) } end |