Commit c1ec991e authored by Robert Speicher's avatar Robert Speicher

Merge branch 'enable-devops-adoption-ff-when-feature-is-in-use' into 'master'

Enable devops_adoption feature flag conditionally

See merge request gitlab-org/gitlab!51602
parents f98e9e8b 06cb4853
......@@ -3,7 +3,8 @@
.container
.gl-mt-3
- if Gitlab.ee? && Feature.enabled?(:devops_adoption_feature, default_enabled: false) && License.feature_available?(:devops_adoption)
- feature_already_in_use = Analytics::DevopsAdoption::Segment.any?
- if Gitlab.ee? && Feature.enabled?(:devops_adoption_feature, default_enabled: feature_already_in_use) && License.feature_available?(:devops_adoption)
= render_if_exists 'admin/dev_ops_report/devops_tabs'
- else
= render 'report'
......
---
title: Enable DevOps Adoption Report feature flag if any Segments already exist
merge_request: 51602
author:
type: other
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/dev_ops_report/show.html.haml' do
include Devise::Test::ControllerHelpers
before do
stub_licensed_features(devops_adoption: true)
end
context 'when no segment record is present' do
it 'disables the feature' do
expect(Feature).to receive(:enabled?).with(:devops_adoption_feature, default_enabled: false).and_return(false)
render
expect(rendered).not_to have_selector('#devops-adoption')
end
end
context 'when at least one segment record is present' do
before do
create(:devops_adoption_segment)
end
it 'enables the feature' do
expect(Feature).to receive(:enabled?).with(:devops_adoption_feature, default_enabled: true).and_return(true)
render
expect(rendered).to have_selector('#devops-adoption')
end
end
end
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