From 6b5aa83354b3dff903eb099bf03da733c36958fc Mon Sep 17 00:00:00 2001 From: jacopo-beschi-intersail Date: Mon, 14 Nov 2016 14:11:55 +0100 Subject: Fix Admin Links to new Group does not respect Default Visibility Settings This is done by passing a visibility_level option to the group edit _form. The visibility_level is set to @group.visibility_level in edit ation and to default_group_visibility in the new action. --- spec/features/admin/admin_groups_spec.rb | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 spec/features/admin/admin_groups_spec.rb (limited to 'spec/features') 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 -- cgit v1.2.1