diff options
| author | Robert Speicher <robert@gitlab.com> | 2016-11-18 13:05:22 +0000 |
|---|---|---|
| committer | Robert Speicher <robert@gitlab.com> | 2016-11-18 13:05:22 +0000 |
| commit | bccdf9f5570728eb312fb0bde26467dfa61d6a91 (patch) | |
| tree | 26561c69ca373a72bc8c7c37c281dc1e7a35990b | |
| parent | d389ed730fc87cc8051ec04f9fa8385270852411 (diff) | |
| parent | 6b5aa83354b3dff903eb099bf03da733c36958fc (diff) | |
| download | gitlab-ce-bccdf9f5570728eb312fb0bde26467dfa61d6a91.tar.gz | |
Merge branch 'jacopo-beschi/gitlab-ce-19981-admin-links-new-group-default-visibility' into 'master'
Fix Admin Links to new Group does not respect Default Visibility
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/19981
See merge request !7560
| -rw-r--r-- | app/views/admin/groups/_form.html.haml | 2 | ||||
| -rw-r--r-- | app/views/admin/groups/edit.html.haml | 2 | ||||
| -rw-r--r-- | app/views/admin/groups/new.html.haml | 2 | ||||
| -rw-r--r-- | changelogs/unreleased/19981-admin-links-new-group-default-visibility.yml | 4 | ||||
| -rw-r--r-- | spec/features/admin/admin_groups_spec.rb | 35 |
5 files changed, 42 insertions, 3 deletions
diff --git a/app/views/admin/groups/_form.html.haml b/app/views/admin/groups/_form.html.haml index 817910f7ddf..589f4557b52 100644 --- a/app/views/admin/groups/_form.html.haml +++ b/app/views/admin/groups/_form.html.haml @@ -7,7 +7,7 @@ .col-sm-10 = render 'shared/choose_group_avatar_button', f: f - = render 'shared/visibility_level', f: f, visibility_level: @group.visibility_level, can_change_visibility_level: can_change_group_visibility_level?(@group), form_model: @group + = render 'shared/visibility_level', f: f, visibility_level: visibility_level, can_change_visibility_level: can_change_group_visibility_level?(@group), form_model: @group .form-group .col-sm-offset-2.col-sm-10 diff --git a/app/views/admin/groups/edit.html.haml b/app/views/admin/groups/edit.html.haml index eb09a6328ed..c2b9807015d 100644 --- a/app/views/admin/groups/edit.html.haml +++ b/app/views/admin/groups/edit.html.haml @@ -1,4 +1,4 @@ - page_title "Edit", @group.name, "Groups" %h3.page-title Edit group: #{@group.name} %hr -= render 'form' += render 'form', visibility_level: @group.visibility_level diff --git a/app/views/admin/groups/new.html.haml b/app/views/admin/groups/new.html.haml index c81ee552ac3..8f9fe96249f 100644 --- a/app/views/admin/groups/new.html.haml +++ b/app/views/admin/groups/new.html.haml @@ -1,4 +1,4 @@ - page_title "New Group" %h3.page-title New group %hr -= render 'form' += render 'form', visibility_level: default_group_visibility diff --git a/changelogs/unreleased/19981-admin-links-new-group-default-visibility.yml b/changelogs/unreleased/19981-admin-links-new-group-default-visibility.yml new file mode 100644 index 00000000000..18fb8a6ad45 --- /dev/null +++ b/changelogs/unreleased/19981-admin-links-new-group-default-visibility.yml @@ -0,0 +1,4 @@ +--- +title: Make New Group form respect default visibility application setting +merge_request: 7454 +author: Jacopo Beschi @jacopo-beschi diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb new file mode 100644 index 00000000000..f6d625fa7f6 --- /dev/null +++ b/spec/features/admin/admin_groups_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +feature 'Admin Groups', feature: true do + let(:internal) { Gitlab::VisibilityLevel::INTERNAL } + + before do + login_as(:admin) + + stub_application_setting(default_group_visibility: internal) + end + + describe 'create a group' do + scenario 'shows the visibility level radio populated with the default value' do + visit new_admin_group_path + + expect_selected_visibility(internal) + end + end + + describe 'group edit' do + scenario 'shows the visibility level radio populated with the group visibility_level value' do + group = create(:group, :private) + + visit edit_admin_group_path(group) + + expect_selected_visibility(group.visibility_level) + end + end + + def expect_selected_visibility(level) + selector = "#group_visibility_level_#{level}[checked=checked]" + + expect(page).to have_selector(selector, count: 1) + end +end |
