summaryrefslogtreecommitdiff
path: root/spec/features/admin/admin_groups_spec.rb
diff options
context:
space:
mode:
authorjacopo-beschi-intersail <jacopo.beschi@intersail.it>2016-11-14 14:11:55 +0100
committerRobert Speicher <rspeicher@gmail.com>2016-11-18 13:39:29 +0200
commit6b5aa83354b3dff903eb099bf03da733c36958fc (patch)
tree6f5fb1773997cd60ded762f55007b4017e6c6e7b /spec/features/admin/admin_groups_spec.rb
parent4e9b02c3e8174118c933e55aec3ddfd763c5984d (diff)
downloadgitlab-ce-6b5aa83354b3dff903eb099bf03da733c36958fc.tar.gz
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.
Diffstat (limited to 'spec/features/admin/admin_groups_spec.rb')
-rw-r--r--spec/features/admin/admin_groups_spec.rb35
1 files changed, 35 insertions, 0 deletions
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