diff options
author | Rémy Coutable <remy@rymai.me> | 2018-04-18 17:52:37 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-04-18 17:52:37 +0000 |
commit | a3bbd0391864d434b7485cea0267624a697aac27 (patch) | |
tree | d1b7064a2c2bb1dbbd14f24b0c7719e08fd33f2f /spec | |
parent | 36df521dc90c86cf3bc2d289283a4ad2c80d5e63 (diff) | |
parent | 2a9a2b22e622103b753e98cfee856c7f7dabad5f (diff) | |
download | gitlab-ce-a3bbd0391864d434b7485cea0267624a697aac27.tar.gz |
Merge branch 'bvl-shared-groups-on-group-page' into 'master'
Fix issues on groups group trees
Closes #42407
See merge request gitlab-org/gitlab-ce!18390
Diffstat (limited to 'spec')
-rw-r--r-- | spec/finders/group_descendants_finder_spec.rb | 9 | ||||
-rw-r--r-- | spec/models/concerns/group_descendant_spec.rb | 17 |
2 files changed, 16 insertions, 10 deletions
diff --git a/spec/finders/group_descendants_finder_spec.rb b/spec/finders/group_descendants_finder_spec.rb index 375bcc9087e..796d40cb625 100644 --- a/spec/finders/group_descendants_finder_spec.rb +++ b/spec/finders/group_descendants_finder_spec.rb @@ -35,15 +35,6 @@ describe GroupDescendantsFinder do expect(finder.execute).to contain_exactly(project) end - it 'does not include projects shared with the group' do - project = create(:project, namespace: group) - other_project = create(:project) - other_project.project_group_links.create(group: group, - group_access: ProjectGroupLink::MASTER) - - expect(finder.execute).to contain_exactly(project) - end - context 'when archived is `true`' do let(:params) { { archived: 'true' } } diff --git a/spec/models/concerns/group_descendant_spec.rb b/spec/models/concerns/group_descendant_spec.rb index c163fb01a81..28352d8c961 100644 --- a/spec/models/concerns/group_descendant_spec.rb +++ b/spec/models/concerns/group_descendant_spec.rb @@ -79,9 +79,24 @@ describe GroupDescendant, :nested_groups do expect(described_class.build_hierarchy(groups)).to eq(expected_hierarchy) end + it 'tracks the exception when a parent was not preloaded' do + expect(Gitlab::Sentry).to receive(:track_exception).and_call_original + + expect { GroupDescendant.build_hierarchy([subsub_group]) }.to raise_error(ArgumentError) + end + + it 'recovers if a parent was not reloaded by querying for the parent' do + expected_hierarchy = { parent => { subgroup => subsub_group } } + + # this does not raise in production, so stubbing it here. + allow(Gitlab::Sentry).to receive(:track_exception) + + expect(GroupDescendant.build_hierarchy([subsub_group])).to eq(expected_hierarchy) + end + it 'raises an error if not all elements were preloaded' do expect { described_class.build_hierarchy([subsub_group]) } - .to raise_error('parent was not preloaded') + .to raise_error(/was not preloaded/) end end end |