diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2019-07-17 19:52:03 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-17 19:52:03 +0000 |
commit | 0e62440722b14db14f54498d1fb3c389cbfe367f (patch) | |
tree | 376d2c53a90bdf50f664946a377e919afc0786ce | |
parent | 78f461bbab6e0ee51472dba63f705bfed061f869 (diff) | |
download | gitlab-ce-0e62440722b14db14f54498d1fb3c389cbfe367f.tar.gz |
Fix factory default for pages_access_level
Pages access level currently depends on project visibilty
which is ignored by factory, this commit fixes that
-rw-r--r-- | spec/factories/projects.rb | 4 | ||||
-rw-r--r-- | spec/services/projects/update_service_spec.rb | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 7d7738a30c8..0e8810b73a1 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -25,7 +25,9 @@ FactoryBot.define do issues_access_level ProjectFeature::ENABLED merge_requests_access_level ProjectFeature::ENABLED repository_access_level ProjectFeature::ENABLED - pages_access_level ProjectFeature::ENABLED + pages_access_level do + visibility_level == Gitlab::VisibilityLevel::PUBLIC ? ProjectFeature::ENABLED : ProjectFeature::PRIVATE + end # we can't assign the delegated `#ci_cd_settings` attributes directly, as the # `#ci_cd_settings` relation needs to be created first diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb index 1dcfb739eb6..6bbaa410d56 100644 --- a/spec/services/projects/update_service_spec.rb +++ b/spec/services/projects/update_service_spec.rb @@ -347,13 +347,13 @@ describe Projects::UpdateService do context 'when updating #pages_access_level' do subject(:call_service) do - update_project(project, admin, project_feature_attributes: { pages_access_level: ProjectFeature::PRIVATE }) + update_project(project, admin, project_feature_attributes: { pages_access_level: ProjectFeature::ENABLED }) end it 'updates the attribute' do expect { call_service } .to change { project.project_feature.pages_access_level } - .to(ProjectFeature::PRIVATE) + .to(ProjectFeature::ENABLED) end it 'calls Projects::UpdatePagesConfigurationService' do |