diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-11 18:15:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-11 18:15:55 +0300 |
commit | a8281ac43424e4b820286823bdb48f068b21d7d3 (patch) | |
tree | f8064c724e33f22402ecc4bd0a8c23ea01e6eac1 /spec/models/namespace_setting_spec.rb | |
parent | 22391da1261240ecc15aa15cbb19b089339902b5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/namespace_setting_spec.rb')
-rw-r--r-- | spec/models/namespace_setting_spec.rb | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/spec/models/namespace_setting_spec.rb b/spec/models/namespace_setting_spec.rb index 429727c2360..c9f8a1bcdc2 100644 --- a/spec/models/namespace_setting_spec.rb +++ b/spec/models/namespace_setting_spec.rb @@ -126,57 +126,4 @@ RSpec.describe NamespaceSetting, type: :model do end end end - - describe 'hooks related to group user cap update' do - let(:settings) { create(:namespace_settings, new_user_signups_cap: user_cap) } - let(:group) { create(:group, namespace_settings: settings) } - - before do - allow(group).to receive(:root?).and_return(true) - end - - context 'when updating a group with a user cap' do - let(:user_cap) { nil } - - it 'also sets share_with_group_lock and prevent_sharing_groups_outside_hierarchy to true' do - expect(group.new_user_signups_cap).to be_nil - expect(group.share_with_group_lock).to be_falsey - expect(settings.prevent_sharing_groups_outside_hierarchy).to be_falsey - - settings.update!(new_user_signups_cap: 10) - group.reload - - expect(group.new_user_signups_cap).to eq(10) - expect(group.share_with_group_lock).to be_truthy - expect(settings.reload.prevent_sharing_groups_outside_hierarchy).to be_truthy - end - - it 'has share_with_group_lock and prevent_sharing_groups_outside_hierarchy returning true for descendent groups' do - descendent = create(:group, parent: group) - desc_settings = descendent.namespace_settings - - expect(descendent.share_with_group_lock).to be_falsey - expect(desc_settings.prevent_sharing_groups_outside_hierarchy).to be_falsey - - settings.update!(new_user_signups_cap: 10) - - expect(descendent.reload.share_with_group_lock).to be_truthy - expect(desc_settings.reload.prevent_sharing_groups_outside_hierarchy).to be_truthy - end - end - - context 'when removing a user cap from namespace settings' do - let(:user_cap) { 10 } - - it 'leaves share_with_group_lock and prevent_sharing_groups_outside_hierarchy set to true to the related group' do - expect(group.share_with_group_lock).to be_truthy - expect(settings.prevent_sharing_groups_outside_hierarchy).to be_truthy - - settings.update!(new_user_signups_cap: nil) - - expect(group.reload.share_with_group_lock).to be_truthy - expect(settings.reload.prevent_sharing_groups_outside_hierarchy).to be_truthy - end - end - end end |