diff options
Diffstat (limited to 'spec/features/projects/settings/packages_settings_spec.rb')
-rw-r--r-- | spec/features/projects/settings/packages_settings_spec.rb | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/spec/features/projects/settings/packages_settings_spec.rb b/spec/features/projects/settings/packages_settings_spec.rb index 057e6b635fe..1c2b0faa215 100644 --- a/spec/features/projects/settings/packages_settings_spec.rb +++ b/spec/features/projects/settings/packages_settings_spec.rb @@ -11,6 +11,7 @@ RSpec.describe 'Projects > Settings > Packages', :js do sign_in(user) stub_config(packages: { enabled: packages_enabled }) + stub_feature_flags(package_registry_access_level: package_registry_access_level) visit edit_project_path(project) end @@ -18,14 +19,31 @@ RSpec.describe 'Projects > Settings > Packages', :js do context 'Packages enabled in config' do let(:packages_enabled) { true } - it 'displays the packages toggle button' do - expect(page).to have_selector('[data-testid="toggle-label"]', text: 'Packages') - expect(page).to have_selector('input[name="project[packages_enabled]"] + button', visible: true) + context 'with feature flag disabled' do + let(:package_registry_access_level) { false } + + it 'displays the packages toggle button' do + expect(page).to have_selector('[data-testid="toggle-label"]', text: 'Packages') + expect(page).to have_selector('input[name="project[packages_enabled]"] + button', visible: true) + end + end + + context 'with feature flag enabled' do + let(:package_registry_access_level) { true } + + it 'displays the packages access level setting' do + expect(page).to have_selector('[data-testid="package-registry-access-level"] > label', text: 'Package registry') + expect(page).to have_selector( + 'input[name="project[project_feature_attributes][package_registry_access_level]"]', + visible: false + ) + end end end context 'Packages disabled in config' do let(:packages_enabled) { false } + let(:package_registry_access_level) { false } it 'does not show up in UI' do expect(page).not_to have_selector('[data-testid="toggle-label"]', text: 'Packages') |