Only take unarchived projects into account

When finding children for a group
This commit is contained in:
Bob Van Landuyt 2017-09-21 09:20:37 +02:00
parent 29df1ce841
commit e13753fcaa
2 changed files with 8 additions and 2 deletions

View file

@ -6,7 +6,7 @@ class GroupDescendantsFinder
def initialize(current_user: nil, parent_group:, params: {})
@current_user = current_user
@parent_group = parent_group
@params = params
@params = params.reverse_merge(non_archived: true)
end
def execute
@ -74,7 +74,7 @@ class GroupDescendantsFinder
end
def projects_matching_filter
ProjectsFinder.new(current_user: current_user).execute
ProjectsFinder.new(current_user: current_user, params: params).execute
.search(params[:filter])
.where(namespace: all_descendant_groups)
end

View file

@ -19,6 +19,12 @@ describe GroupDescendantsFinder do
expect(finder.execute).to contain_exactly(project)
end
it 'does not include archived projects' do
_archived_project = create(:project, :archived, namespace: group)
expect(finder.execute).to be_empty
end
context 'with a filter' do
let(:params) { { filter: 'test' } }