diff options
Diffstat (limited to 'qa/spec/specs/helpers/feature_flag_spec.rb')
-rw-r--r-- | qa/spec/specs/helpers/feature_flag_spec.rb | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/qa/spec/specs/helpers/feature_flag_spec.rb b/qa/spec/specs/helpers/feature_flag_spec.rb index 491fc22f026..180890b2701 100644 --- a/qa/spec/specs/helpers/feature_flag_spec.rb +++ b/qa/spec/specs/helpers/feature_flag_spec.rb @@ -122,6 +122,10 @@ RSpec.describe QA::Specs::Helpers::FeatureFlag do end context 'when run on production' do + before do + allow(GitlabEdition).to receive(:jh?).and_return(false) + end + before(:context) do QA::Runtime::Scenario.define(:gitlab_address, 'https://gitlab.com') end @@ -147,6 +151,66 @@ RSpec.describe QA::Specs::Helpers::FeatureFlag do it_behaves_like 'skips with given feature flag metadata', { name: 'global_ff', scope: :global } end + context 'when run on jh production mainland' do + before do + allow(GitlabEdition).to receive(:jh?).and_return(true) + end + + before(:context) do + QA::Runtime::Scenario.define(:gitlab_address, 'https://jihulab.com') + end + + context 'when no scope is defined' do + it_behaves_like 'skips with given feature flag metadata', { name: 'no_scope_ff' } + + context 'for only one test in the example group' do + it 'only skips specified test and runs all others' do + group = describe_successfully 'Feature flag set for one test' do + it('is skipped', feature_flag: { name: 'single_test_ff' }) {} + it('passes') {} + end + + expect(group.examples[0].execution_result.status).to eq(:pending) + expect(group.examples[1].execution_result.status).to eq(:passed) + end + end + end + + it_behaves_like 'skips with given feature flag metadata', { name: 'actor_ff', scope: :project } + + it_behaves_like 'skips with given feature flag metadata', { name: 'global_ff', scope: :global } + end + + context 'when run on jh production hk' do + before do + allow(GitlabEdition).to receive(:jh?).and_return(true) + end + + before(:context) do + QA::Runtime::Scenario.define(:gitlab_address, 'https://jihulab.hk') + end + + context 'when no scope is defined' do + it_behaves_like 'skips with given feature flag metadata', { name: 'no_scope_ff' } + + context 'for only one test in the example group' do + it 'only skips specified test and runs all others' do + group = describe_successfully 'Feature flag set for one test' do + it('is skipped', feature_flag: { name: 'single_test_ff' }) {} + it('passes') {} + end + + expect(group.examples[0].execution_result.status).to eq(:pending) + expect(group.examples[1].execution_result.status).to eq(:passed) + end + end + end + + it_behaves_like 'skips with given feature flag metadata', { name: 'actor_ff', scope: :project } + + it_behaves_like 'skips with given feature flag metadata', { name: 'global_ff', scope: :global } + end + context 'when run on pre' do before(:context) do QA::Runtime::Scenario.define(:gitlab_address, 'https://pre.gitlab.com') |