Commit c35745fd authored by Michael Kozono's avatar Michael Kozono

Merge branch '31914-support-multiple-query-on-todos-finder-author-pd' into 'master'

Add spec for filtering by multiple authors

See merge request gitlab-org/gitlab!18488
parents b1ed538b 62b45829
...@@ -73,6 +73,28 @@ describe TodosFinder do ...@@ -73,6 +73,28 @@ describe TodosFinder do
end end
end end
context 'when filtering by author' do
let(:author1) { create(:user) }
let(:author2) { create(:user) }
let!(:todo1) { create(:todo, user: user, author: author1) }
let!(:todo2) { create(:todo, user: user, author: author2) }
it 'returns correct todos when filtering by an author' do
todos = finder.new(user, { author_id: author1.id }).execute
expect(todos).to match_array([todo1])
end
context 'querying for multiple authors' do
it 'returns the correct todo items' do
todos = finder.new(user, { author_id: [author2.id, author1.id] }).execute
expect(todos).to match_array([todo2, todo1])
end
end
end
context 'with subgroups' do context 'with subgroups' do
let(:subgroup) { create(:group, parent: group) } let(:subgroup) { create(:group, parent: group) }
let!(:todo3) { create(:todo, user: user, group: subgroup, target: issue) } let!(:todo3) { create(:todo, user: user, group: subgroup, target: issue) }
......
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