diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-15 21:06:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-15 21:06:01 +0300 |
commit | 7b8ec6e718331dd1f8330f08f49f01ba2c20b84c (patch) | |
tree | 560992bd23b96c85e8b006258a8ece3fb25d088e /spec/finders/todos_finder_spec.rb | |
parent | 03087faa6b679cd82a8a7b5f6491edc414ed91eb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders/todos_finder_spec.rb')
-rw-r--r-- | spec/finders/todos_finder_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/finders/todos_finder_spec.rb b/spec/finders/todos_finder_spec.rb index a0bf48f218a..9a3ffffb3f2 100644 --- a/spec/finders/todos_finder_spec.rb +++ b/spec/finders/todos_finder_spec.rb @@ -73,6 +73,28 @@ describe TodosFinder do 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 let(:subgroup) { create(:group, parent: group) } let!(:todo3) { create(:todo, user: user, group: subgroup, target: issue) } |