Commit 06cb4853 authored by Adam Hegyi's avatar Adam Hegyi

Enable devops_adoption feature flag conditionally

This change enables the devops_adoption_feature flag by default if the
feature is already in use.
parent d89d8429
......@@ -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