Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 18:06:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 18:06:12 +0300
commit6e81d7f6283fae1b22f66b9d9b133243921cbd9e (patch)
tree8cf8052ef6734ceeb49314f15ff07d2720511f0d /spec/finders
parent3fc9a8e6957ddf75576dc63069c4c0249514499f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/todos_finder_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/finders/todos_finder_spec.rb b/spec/finders/todos_finder_spec.rb
index 75aa10c66a2..a837e7af251 100644
--- a/spec/finders/todos_finder_spec.rb
+++ b/spec/finders/todos_finder_spec.rb
@@ -163,6 +163,28 @@ describe TodosFinder do
expect(todos).to match_array([todo1, todo2])
end
end
+
+ context 'by project' do
+ let_it_be(:project1) { create(:project) }
+ let_it_be(:project2) { create(:project) }
+ let_it_be(:project3) { create(:project) }
+
+ let!(:todo1) { create(:todo, user: user, project: project1, state: :pending) }
+ let!(:todo2) { create(:todo, user: user, project: project2, state: :pending) }
+ let!(:todo3) { create(:todo, user: user, project: project3, state: :pending) }
+
+ it 'returns the expected todos for one project' do
+ todos = finder.new(user, { project_id: project2.id }).execute
+
+ expect(todos).to match_array([todo2])
+ end
+
+ it 'returns the expected todos for many projects' do
+ todos = finder.new(user, { project_id: [project2.id, project1.id] }).execute
+
+ expect(todos).to match_array([todo2, todo1])
+ end
+ end
end
context 'external authorization' do