Commit a2fc2338 authored by Jan Provaznik's avatar Jan Provaznik

Minor improvements of group search

* improves the spec to assure that subgroups are still searched
* avoids negation of param
parent 6b9613d7
......@@ -100,7 +100,7 @@ class GroupsFinder < UnionFinder
def by_search(groups)
return groups unless params[:search].present?
groups.search(params[:search], include_parents: !params[:parent].present?)
groups.search(params[:search], include_parents: params[:parent].blank?)
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -243,7 +243,9 @@ RSpec.describe GroupsFinder do
end
it 'does not search in full path if parent is set' do
expect(described_class.new(user, { search: 'parent', parent: parent_group }).execute).to be_empty
matching_subgroup = create(:group, parent: parent_group, path: "#{parent_group.path}-subgroup")
expect(described_class.new(user, { search: 'parent', parent: parent_group }).execute).to contain_exactly(matching_subgroup)
end
context 'with group descendants' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment