Commit c4b2356f authored by Aleksei Lipniagov's avatar Aleksei Lipniagov

Merge branch '342826-remove-compliance-framework-settings-for-unlicensed-ee' into 'master'

Remove compliance framework section on project settings and compliance badge for unlicensed EE

See merge request gitlab-org/gitlab!72691
parents 3092320b 3578a1c8
......@@ -247,7 +247,7 @@ module EE
end
def show_compliance_framework_badge?(project)
project&.compliance_framework_setting&.compliance_management_framework.present?
project&.licensed_feature_available?(:custom_compliance_frameworks) && project&.compliance_framework_setting&.compliance_management_framework.present?
end
def scheduled_for_deletion?(project)
......
- return unless @project.feature_available?(:custom_compliance_frameworks)
- user_has_edit_permissions = current_user.can?(:admin_compliance_framework, @project)
- compliance_framework_doc_link = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/project/settings/index.md', anchor: 'compliance-frameworks') }
......
......@@ -70,14 +70,36 @@ RSpec.describe ProjectsHelper do
end
describe '#show_compliance_framework_badge?' do
it 'returns false if compliance framework setting is not present' do
expect(helper.show_compliance_framework_badge?(project)).to be_falsey
context 'when feature is licensed' do
before do
stub_licensed_features(custom_compliance_frameworks: true)
end
it 'returns false if compliance framework setting is not present' do
expect(helper.show_compliance_framework_badge?(project)).to be_falsey
end
it 'returns true if compliance framework setting is present' do
project = build_stubbed(:project, :with_compliance_framework)
expect(helper.show_compliance_framework_badge?(project)).to be_truthy
end
end
it 'returns true if compliance framework setting is present' do
project = build_stubbed(:project, :with_compliance_framework)
context 'when feature is unlicensed' do
before do
stub_licensed_features(custom_compliance_frameworks: false)
end
it 'returns false if compliance framework setting is not present' do
expect(helper.show_compliance_framework_badge?(project)).to be_falsey
end
it 'returns false if compliance framework setting is present' do
project = build_stubbed(:project, :with_compliance_framework)
expect(helper.show_compliance_framework_badge?(project)).to be_truthy
expect(helper.show_compliance_framework_badge?(project)).to be_falsey
end
end
end
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'compliance_management/compliance_framework/_project_settings.html.haml' do
let_it_be(:group) { create(:group) }
let_it_be(:group_owner) { create(:user) }
let_it_be(:project) { create(:project, namespace: group) }
let_it_be(:project) { create(:project, :with_compliance_framework, namespace: group) }
before do
allow(view).to receive(:current_user).and_return(group_owner)
......
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