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:
Diffstat (limited to 'spec/finders/todos_finder_spec.rb')
-rw-r--r--spec/finders/todos_finder_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/finders/todos_finder_spec.rb b/spec/finders/todos_finder_spec.rb
index f7b35e76925..a0bf48f218a 100644
--- a/spec/finders/todos_finder_spec.rb
+++ b/spec/finders/todos_finder_spec.rb
@@ -36,6 +36,43 @@ describe TodosFinder do
expect(todos).to match_array([todo1])
end
+ context 'when filtering for actions' do
+ let!(:todo1) { create(:todo, user: user, project: project, target: issue, action: Todo::ASSIGNED) }
+ let!(:todo2) { create(:todo, user: user, group: group, target: merge_request, action: Todo::DIRECTLY_ADDRESSED) }
+
+ context 'by action ids' do
+ it 'returns the expected todos' do
+ todos = finder.new(user, { action_id: Todo::DIRECTLY_ADDRESSED }).execute
+
+ expect(todos).to match_array([todo2])
+ end
+
+ context 'multiple actions' do
+ it 'returns the expected todos' do
+ todos = finder.new(user, { action_id: [Todo::DIRECTLY_ADDRESSED, Todo::ASSIGNED] }).execute
+
+ expect(todos).to match_array([todo2, todo1])
+ end
+ end
+ end
+
+ context 'by action names' do
+ it 'returns the expected todos' do
+ todos = finder.new(user, { action: :directly_addressed }).execute
+
+ expect(todos).to match_array([todo2])
+ end
+
+ context 'multiple actions' do
+ it 'returns the expected todos' do
+ todos = finder.new(user, { action: [:directly_addressed, :assigned] }).execute
+
+ expect(todos).to match_array([todo2, todo1])
+ end
+ end
+ end
+ end
+
context 'with subgroups' do
let(:subgroup) { create(:group, parent: group) }
let!(:todo3) { create(:todo, user: user, group: subgroup, target: issue) }