Commit 45c51442 authored by Robert Speicher's avatar Robert Speicher

Merge branch '34824-beta-access-to-licenses-list' into 'master'

Allow beta access to licenses list

See merge request gitlab-org/gitlab!21155
parents a6ad3119 dae2f95c
...@@ -82,7 +82,7 @@ module EE ...@@ -82,7 +82,7 @@ module EE
with_scope :subject with_scope :subject
condition(:licenses_list_enabled) do condition(:licenses_list_enabled) do
@subject.feature_available?(:licenses_list) @subject.beta_feature_available?(:licenses_list)
end end
with_scope :subject with_scope :subject
......
...@@ -815,7 +815,8 @@ describe ProjectPolicy do ...@@ -815,7 +815,8 @@ describe ProjectPolicy do
context 'when licenses list feature available' do context 'when licenses list feature available' do
context 'when license management feature available' do context 'when license management feature available' do
before do before do
stub_licensed_features(licenses_list: true, license_management: true) stub_feature_flags(licenses_list: true)
stub_licensed_features(license_management: true)
end end
context 'with public project' do context 'with public project' do
...@@ -851,11 +852,23 @@ describe ProjectPolicy do ...@@ -851,11 +852,23 @@ describe ProjectPolicy do
end end
end end
context "when the licenses_list feature is enabled for a specific project" do
let(:current_user) { create(:user) }
before do
stub_feature_flags(licenses_list: { enabled: true, thing: project })
stub_licensed_features(license_management: true)
end
it { is_expected.to be_allowed(:read_licenses_list) }
end
context 'when license management feature in not available' do context 'when license management feature in not available' do
let(:current_user) { admin } let(:current_user) { admin }
before do before do
stub_licensed_features(licenses_list: true) stub_feature_flags(licenses_list: true)
stub_licensed_features(license_management: false)
end end
it { is_expected.to be_disallowed(:read_licenses_list) } it { is_expected.to be_disallowed(:read_licenses_list) }
...@@ -865,6 +878,10 @@ describe ProjectPolicy do ...@@ -865,6 +878,10 @@ describe ProjectPolicy do
context 'when licenses list feature not available' do context 'when licenses list feature not available' do
let(:current_user) { admin } let(:current_user) { admin }
before do
stub_feature_flags(licenses_list: false)
end
it { is_expected.to be_disallowed(:read_licenses_list) } it { is_expected.to be_disallowed(:read_licenses_list) }
end 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