Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/invite_members_helper_spec.rb')
-rw-r--r--spec/helpers/invite_members_helper_spec.rb46
1 files changed, 22 insertions, 24 deletions
diff --git a/spec/helpers/invite_members_helper_spec.rb b/spec/helpers/invite_members_helper_spec.rb
index 859d145eb53..4d47732e008 100644
--- a/spec/helpers/invite_members_helper_spec.rb
+++ b/spec/helpers/invite_members_helper_spec.rb
@@ -30,6 +30,28 @@ RSpec.describe InviteMembersHelper do
expect(helper.common_invite_group_modal_data(project, ProjectMember, 'true')).to include(attributes)
end
+
+ context 'when sharing with groups outside the hierarchy is disabled' do
+ let_it_be(:group) { create(:group) }
+
+ before do
+ group.update!(prevent_sharing_groups_outside_hierarchy: true)
+ end
+
+ it 'provides the correct attributes' do
+ expect(helper.common_invite_group_modal_data(group, GroupMember, 'false')).to include({ groups_filter: 'descendant_groups', parent_id: group.id })
+ end
+ end
+
+ context 'when sharing with groups outside the hierarchy is enabled' do
+ before do
+ group.update!(prevent_sharing_groups_outside_hierarchy: false)
+ end
+
+ it 'does not return filter attributes' do
+ expect(helper.common_invite_group_modal_data(project.group, ProjectMember, 'true').keys).not_to include(:groups_filter, :parent_id)
+ end
+ end
end
describe '#common_invite_modal_dataset' do
@@ -162,28 +184,4 @@ RSpec.describe InviteMembersHelper do
end
end
end
-
- describe '#group_select_data' do
- let_it_be(:group) { create(:group) }
-
- context 'when sharing with groups outside the hierarchy is disabled' do
- before do
- group.namespace_settings.update!(prevent_sharing_groups_outside_hierarchy: true)
- end
-
- it 'provides the correct attributes' do
- expect(helper.group_select_data(group)).to eq({ groups_filter: 'descendant_groups', parent_id: group.id })
- end
- end
-
- context 'when sharing with groups outside the hierarchy is enabled' do
- before do
- group.namespace_settings.update!(prevent_sharing_groups_outside_hierarchy: false)
- end
-
- it 'returns an empty hash' do
- expect(helper.group_select_data(project.group)).to eq({})
- end
- end
- end
end