diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/helpers/invite_members_helper_spec.rb | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/helpers/invite_members_helper_spec.rb')
-rw-r--r-- | spec/helpers/invite_members_helper_spec.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/helpers/invite_members_helper_spec.rb b/spec/helpers/invite_members_helper_spec.rb index d8a97b93bc9..6a854a65920 100644 --- a/spec/helpers/invite_members_helper_spec.rb +++ b/spec/helpers/invite_members_helper_spec.rb @@ -15,6 +15,22 @@ RSpec.describe InviteMembersHelper do helper.extend(Gitlab::Experimentation::ControllerConcern) end + describe '#common_invite_group_modal_data' do + it 'has expected common attributes' do + attributes = { + id: project.id, + name: project.name, + default_access_level: Gitlab::Access::GUEST, + invalid_groups: project.related_group_ids, + help_link: help_page_url('user/permissions'), + is_project: 'true', + access_levels: ProjectMember.access_level_roles.to_json + } + + expect(helper.common_invite_group_modal_data(project, ProjectMember, 'true')).to include(attributes) + end + end + describe '#common_invite_modal_dataset' do it 'has expected common attributes' do attributes = { @@ -155,4 +171,28 @@ 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 |