diff options
Diffstat (limited to 'spec/models/project_feature_spec.rb')
-rw-r--r-- | spec/models/project_feature_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/models/project_feature_spec.rb b/spec/models/project_feature_spec.rb index 37402fa04c4..a56018f0fee 100644 --- a/spec/models/project_feature_spec.rb +++ b/spec/models/project_feature_spec.rb @@ -40,7 +40,7 @@ RSpec.describe ProjectFeature do end context 'public features' do - features = %w(issues wiki builds merge_requests snippets repository metrics_dashboard operations) + features = ProjectFeature::FEATURES - %i(pages) features.each do |feature| it "does not allow public access level for #{feature}" do @@ -187,4 +187,30 @@ RSpec.describe ProjectFeature do expect(described_class.required_minimum_access_level_for_private_project(:issues)).to eq(Gitlab::Access::GUEST) end end + + describe 'container_registry_access_level' do + context 'when the project is created with container_registry_enabled false' do + it 'creates project with DISABLED container_registry_access_level' do + project = create(:project, container_registry_enabled: false) + + expect(project.project_feature.container_registry_access_level).to eq(described_class::DISABLED) + end + end + + context 'when the project is created with container_registry_enabled true' do + it 'creates project with ENABLED container_registry_access_level' do + project = create(:project, container_registry_enabled: true) + + expect(project.project_feature.container_registry_access_level).to eq(described_class::ENABLED) + end + end + + context 'when the project is created with container_registry_enabled nil' do + it 'creates project with DISABLED container_registry_access_level' do + project = create(:project, container_registry_enabled: nil) + + expect(project.project_feature.container_registry_access_level).to eq(described_class::DISABLED) + end + end + end end |