summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-05-25 22:42:42 -0700
committerStan Hu <stanhu@gmail.com>2019-06-05 16:43:31 -0700
commitf8d93b24822937d803da4c9fcc89d50c85de89c7 (patch)
tree4e26c50a4887dbe46ad0bf7df46c3bc09d48d001 /spec/features
parente6a88b024fa7f8e1ec5b712744d0e0d118b026e6 (diff)
downloadgitlab-ce-f8d93b24822937d803da4c9fcc89d50c85de89c7.tar.gz
Set project default visibility to max allowed
If the default, instance-wide visibility were set to internal but a group were private, the radio button would be set on internal even though that setting were not allowed. We now consider the allowed visibility setting for the group in determining what the default should be. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/62298
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/projects/new_project_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb
index b54ea929978..033e1afe866 100644
--- a/spec/features/projects/new_project_spec.rb
+++ b/spec/features/projects/new_project_spec.rb
@@ -63,6 +63,36 @@ describe 'New project' do
end
end
end
+
+ context 'when group visibility is private but default is internal' do
+ before do
+ stub_application_setting(default_project_visibility: Gitlab::VisibilityLevel::INTERNAL)
+ end
+
+ it 'has private selected' do
+ group = create(:group, visibility_level: Gitlab::VisibilityLevel::PRIVATE)
+ visit new_project_path(namespace_id: group.id)
+
+ page.within('#blank-project-pane') do
+ expect(find_field("project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).to be_checked
+ end
+ end
+ end
+
+ context 'when group visibility is public but user requests private' do
+ before do
+ stub_application_setting(default_project_visibility: Gitlab::VisibilityLevel::INTERNAL)
+ end
+
+ it 'has private selected' do
+ group = create(:group, visibility_level: Gitlab::VisibilityLevel::PUBLIC)
+ visit new_project_path(namespace_id: group.id, project: { visibility_level: Gitlab::VisibilityLevel::PRIVATE })
+
+ page.within('#blank-project-pane') do
+ expect(find_field("project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).to be_checked
+ end
+ end
+ end
end
context 'Readme selector' do