debian-mirror-gitlab/spec/features/groups/share_lock_spec.rb

74 lines
1.8 KiB
Ruby
Raw Normal View History

2018-03-17 18:26:18 +05:30
require 'spec_helper'
2018-11-08 19:23:39 +05:30
describe 'Group share with group lock' do
let(:root_owner) { create(:user) }
let(:root_group) { create(:group) }
2018-03-17 18:26:18 +05:30
2018-11-08 19:23:39 +05:30
before do
2018-03-17 18:26:18 +05:30
root_group.add_owner(root_owner)
sign_in(root_owner)
end
context 'with a subgroup', :nested_groups do
2018-11-08 19:23:39 +05:30
let!(:subgroup) { create(:group, parent: root_group) }
2018-03-17 18:26:18 +05:30
context 'when enabling the parent group share with group lock' do
2018-11-08 19:23:39 +05:30
it 'the subgroup share with group lock becomes enabled' do
2018-03-17 18:26:18 +05:30
visit edit_group_path(root_group)
2018-11-08 19:23:39 +05:30
enable_group_lock
2018-03-17 18:26:18 +05:30
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
2018-11-08 19:23:39 +05:30
before do
2018-03-17 18:26:18 +05:30
visit edit_group_path(root_group)
2018-11-08 19:23:39 +05:30
enable_group_lock
2018-03-17 18:26:18 +05:30
end
context 'and the subgroup share with group lock is enabled' do
2018-11-08 19:23:39 +05:30
it 'the subgroup share with group lock does not change' do
2018-03-17 18:26:18 +05:30
visit edit_group_path(root_group)
2018-11-08 19:23:39 +05:30
disable_group_lock
2018-03-17 18:26:18 +05:30
expect(subgroup.reload.share_with_group_lock?).to be_truthy
end
end
context 'but the subgroup share with group lock is disabled' do
2018-11-08 19:23:39 +05:30
before do
2018-03-17 18:26:18 +05:30
visit edit_group_path(subgroup)
2018-11-08 19:23:39 +05:30
disable_group_lock
2018-03-17 18:26:18 +05:30
end
2018-11-08 19:23:39 +05:30
it 'the subgroup share with group lock does not change' do
2018-03-17 18:26:18 +05:30
visit edit_group_path(root_group)
2018-11-08 19:23:39 +05:30
disable_group_lock
2018-03-17 18:26:18 +05:30
expect(subgroup.reload.share_with_group_lock?).to be_falsey
end
end
end
end
2018-11-08 19:23:39 +05:30
def enable_group_lock
page.within('.gs-permissions') do
check 'group_share_with_group_lock'
click_on 'Save group'
end
end
def disable_group_lock
page.within('.gs-permissions') do
uncheck 'group_share_with_group_lock'
click_on 'Save group'
end
end
2018-03-17 18:26:18 +05:30
end