Commit 50b5b743 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '7048_add_feature_flag_for_group_overview_preference' into 'master'

Add feature flag for "Group Overview content" preference

See merge request gitlab-org/gitlab-ee!9584
parents 06165c47 b2edbce5
......@@ -12,15 +12,21 @@ module EE
end
def group_view_choices
choices = [
[_('Details (default)'), :details]
]
if License.feature_available?(:security_dashboard)
choices << [_('Security dashboard'), :security_dashboard]
strong_memoize(:group_view_choices) do
[[_('Details (default)'), :details]].tap do |choices|
choices << [_('Security dashboard'), :security_dashboard] if group_view_security_dashboard_enabled?
end
end
end
def group_overview_content_preference?
group_view_choices.size > 1
end
private
choices
def group_view_security_dashboard_enabled?
License.feature_available?(:security_dashboard) && ::Feature.enabled?(:group_overview_security_dashboard)
end
end
end
- return unless group_overview_content_preference?
.form-group
= f.label :group_view, class: 'label-bold' do
= _('Group overview content')
......
......@@ -40,10 +40,42 @@ describe PreferencesHelper do
end
it { is_expected.to include(['Security dashboard', :security_dashboard]) }
context 'but feature flag is disabled' do
before do
stub_feature_flags(group_overview_security_dashboard: false)
end
it { is_expected.not_to include(['Security dashboard', :security_dashboard]) }
end
end
context 'when security dashboard feature is disabled' do
it { is_expected.not_to include(['Security dashboard', :security_dashboard]) }
end
end
describe '#group_overview_content_preference?' do
subject { helper.group_overview_content_preference? }
context 'when security dashboard feature is enabled' do
before do
stub_licensed_features(security_dashboard: true)
end
it { is_expected.to eq(true) }
context 'but feature flag is disabled' do
before do
stub_feature_flags(group_overview_security_dashboard: false)
end
it { is_expected.to eq(false) }
end
end
context 'when security dashboard feature is disabled' do
it { is_expected.to eq(false) }
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