From 5a903149e75465e4025f154977597aeef94b618c Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Wed, 11 Oct 2017 10:17:24 +0200 Subject: Handle archived projects in the `GroupDescendantsFinder` --- spec/finders/group_descendants_finder_spec.rb | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'spec/finders/group_descendants_finder_spec.rb') 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' } } -- cgit v1.2.3