diff options
Diffstat (limited to 'spec/helpers/groups_helper_spec.rb')
-rw-r--r-- | spec/helpers/groups_helper_spec.rb | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb index 36e44a9b941..2c1061d2f1b 100644 --- a/spec/helpers/groups_helper_spec.rb +++ b/spec/helpers/groups_helper_spec.rb @@ -452,9 +452,31 @@ RSpec.describe GroupsHelper do end end - describe '#group_name_and_path_app_data' do - let_it_be(:group) { build(:group, name: 'My awesome group', path: 'my-awesome-group') } + describe '#subgroup_creation_data' do + let_it_be(:name) { 'parent group' } + let_it_be(:group) { build(:group, name: name) } let_it_be(:subgroup) { build(:group, parent: group) } + + context 'when group has a parent' do + it 'returns expected hash' do + expect(subgroup_creation_data(subgroup)).to eq({ + import_existing_group_path: '/groups/new#import-group-pane', + parent_group_name: name + }) + end + end + + context 'when group does not have a parent' do + it 'returns expected hash' do + expect(subgroup_creation_data(group)).to eq({ + import_existing_group_path: '/groups/new#import-group-pane', + parent_group_name: nil + }) + end + end + end + + describe '#group_name_and_path_app_data' do let_it_be(:root_url) { 'https://gitlab.com/' } before do @@ -464,17 +486,10 @@ RSpec.describe GroupsHelper do context 'when group has a parent' do it 'returns expected hash' do - expect(group_name_and_path_app_data(subgroup)).to match( - { base_path: 'https://gitlab.com/my-awesome-group', mattermost_enabled: 'true' } - ) - end - end - - context 'when group does not have a parent' do - it 'returns expected hash' do - expect(group_name_and_path_app_data(group)).to match( - { base_path: root_url, mattermost_enabled: 'true' } - ) + expect(group_name_and_path_app_data).to match({ + base_path: 'https://gitlab.com/', + mattermost_enabled: 'true' + }) end end end @@ -493,7 +508,7 @@ RSpec.describe GroupsHelper do it 'returns expected hash' do expect(helper.subgroups_and_projects_list_app_data(group)).to match({ show_schema_markup: 'true', - new_subgroup_path: including("groups/new?parent_id=#{group.id}"), + new_subgroup_path: including("groups/new?parent_id=#{group.id}#create-group-pane"), new_project_path: including("/projects/new?namespace_id=#{group.id}"), new_subgroup_illustration: including('illustrations/subgroup-create-new-sm'), new_project_illustration: including('illustrations/project-create-new-sm'), |