diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-09-07 21:29:47 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-09-07 21:29:47 +0300 |
commit | 22d6e69ecf004060de31823a8242d249a88c4e46 (patch) | |
tree | c83345b5ee54b32268ca70daedcbdc058ad25ca6 /spec/features/groups | |
parent | 6a4ebc4a9bbc93d627f9da0091dd5050db1a916b (diff) | |
parent | 95f4dd4f1501f3901908f444790eea06f3d703bb (diff) |
Merge branch 'improve-share-locking-feature-for-subgroups' into 'master'
Improve "Share with group lock" feature for subgroups
Closes #30550
See merge request !13944
Diffstat (limited to 'spec/features/groups')
-rw-r--r-- | spec/features/groups/share_lock_spec.rb | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/spec/features/groups/share_lock_spec.rb b/spec/features/groups/share_lock_spec.rb new file mode 100644 index 00000000000..8842d1391aa --- /dev/null +++ b/spec/features/groups/share_lock_spec.rb @@ -0,0 +1,62 @@ +require 'spec_helper' + +feature 'Group share with group lock' do + given(:root_owner) { create(:user) } + given(:root_group) { create(:group) } + + background do + root_group.add_owner(root_owner) + sign_in(root_owner) + end + + context 'with a subgroup', :nested_groups do + given!(:subgroup) { create(:group, parent: root_group) } + + context 'when enabling the parent group share with group lock' do + scenario 'the subgroup share with group lock becomes enabled' do + visit edit_group_path(root_group) + check 'group_share_with_group_lock' + + click_on 'Save group' + + expect(subgroup.reload.share_with_group_lock?).to be_truthy + end + end + + context 'when disabling the parent group share with group lock (which was already enabled)' do + background do + visit edit_group_path(root_group) + check 'group_share_with_group_lock' + click_on 'Save group' + end + + context 'and the subgroup share with group lock is enabled' do + scenario 'the subgroup share with group lock does not change' do + visit edit_group_path(root_group) + uncheck 'group_share_with_group_lock' + + click_on 'Save group' + + expect(subgroup.reload.share_with_group_lock?).to be_truthy + end + end + + context 'but the subgroup share with group lock is disabled' do + background do + visit edit_group_path(subgroup) + uncheck 'group_share_with_group_lock' + click_on 'Save group' + end + + scenario 'the subgroup share with group lock does not change' do + visit edit_group_path(root_group) + uncheck 'group_share_with_group_lock' + + click_on 'Save group' + + expect(subgroup.reload.share_with_group_lock?).to be_falsey + end + end + end + end +end |