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:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-11 11:17:24 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-11 11:17:24 +0300
commit5a903149e75465e4025f154977597aeef94b618c (patch)
tree8ce28b75e6e9ce93edf4878bfa88ef45d2443094 /spec/finders/group_descendants_finder_spec.rb
parent99c76e9fe89434f05f63eb6227597aed882c8388 (diff)
Handle archived projects in the `GroupDescendantsFinder`
Diffstat (limited to 'spec/finders/group_descendants_finder_spec.rb')
-rw-r--r--spec/finders/group_descendants_finder_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/finders/group_descendants_finder_spec.rb b/spec/finders/group_descendants_finder_spec.rb
index 4a5bdd84508..074914420a1 100644
--- a/spec/finders/group_descendants_finder_spec.rb
+++ b/spec/finders/group_descendants_finder_spec.rb
@@ -35,6 +35,28 @@ describe GroupDescendantsFinder do
expect(finder.execute).to contain_exactly(project)
end
+ context 'when archived is `true`' do
+ let(:params) { { archived: 'true' } }
+
+ it 'includes archived projects' do
+ archived_project = create(:project, namespace: group, archived: true)
+ project = create(:project, namespace: group)
+
+ expect(finder.execute).to contain_exactly(archived_project, project)
+ end
+ end
+
+ context 'when archived is `only`' do
+ let(:params) { { archived: 'only' } }
+
+ it 'includes only archived projects' do
+ archived_project = create(:project, namespace: group, archived: true)
+ _project = create(:project, namespace: group)
+
+ expect(finder.execute).to contain_exactly(archived_project)
+ end
+ end
+
it 'does not include archived projects' do
_archived_project = create(:project, :archived, namespace: group)
@@ -84,6 +106,16 @@ describe GroupDescendantsFinder do
expect(finder.execute).to contain_exactly(public_subgroup)
end
+ context 'when archived is `true`' do
+ let(:params) { { archived: 'true' } }
+
+ it 'includes archived projects in the count of subgroups' do
+ create(:project, namespace: subgroup, archived: true)
+
+ expect(finder.execute.first.preloaded_project_count).to eq(1)
+ end
+ end
+
context 'with a filter' do
let(:params) { { filter: 'test' } }