summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHeinrich Lee Yu <hleeyu@gmail.com>2018-10-25 15:02:28 +0800
committerHeinrich Lee Yu <hleeyu@gmail.com>2018-10-26 10:32:14 +0800
commit227e30f7feb2072407a231a762835bf8d5103129 (patch)
tree0773bb5752f5d32842be1176b6c2c7abf859fed3 /spec
parent679c0048a8f679aad456c02e30486150bbd0d93d (diff)
downloadgitlab-ce-227e30f7feb2072407a231a762835bf8d5103129.tar.gz
Issues API: Add None/Any option to assignee_id
Diffstat (limited to 'spec')
-rw-r--r--spec/finders/issues_finder_spec.rb18
-rw-r--r--spec/requests/api/issues_spec.rb15
2 files changed, 32 insertions, 1 deletions
diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb
index 0689c843104..7f4f613b406 100644
--- a/spec/finders/issues_finder_spec.rb
+++ b/spec/finders/issues_finder_spec.rb
@@ -59,11 +59,27 @@ describe IssuesFinder do
context 'filtering by no assignee' do
let(:params) { { assignee_id: 0 } }
- it 'returns issues not assign to any assignee' do
+ it 'returns issues not assigned to any assignee' do
expect(issues).to contain_exactly(issue4)
end
end
+ context 'filtering by no assignee' do
+ let(:params) { { assignee_id: 'None' } }
+
+ it 'returns issues not assigned to any assignee' do
+ expect(issues).to contain_exactly(issue4)
+ end
+ end
+
+ context 'filtering by any assignee' do
+ let(:params) { { assignee_id: 'Any' } }
+
+ it 'returns issues assigned to any assignee' do
+ expect(issues).to contain_exactly(issue1, issue2, issue3)
+ end
+ end
+
context 'filtering by group_id' do
let(:params) { { group_id: group.id } }
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index 9f6cf12f9a7..090e8eac768 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -178,6 +178,21 @@ describe API::Issues do
expect(first_issue['id']).to eq(issue2.id)
end
+ it 'returns issues with no assignee' do
+ issue2 = create(:issue, author: user2, project: project)
+
+ get api('/issues', user), assignee_id: 'None', scope: 'all'
+
+ expect_paginated_array_response(size: 1)
+ expect(first_issue['id']).to eq(issue2.id)
+ end
+
+ it 'returns issues with any assignee' do
+ get api('/issues', user), assignee_id: 'Any', scope: 'all'
+
+ expect_paginated_array_response(size: 3)
+ end
+
it 'returns issues reacted by the authenticated user by the given emoji' do
issue2 = create(:issue, project: project, author: user, assignees: [user])
award_emoji = create(:award_emoji, awardable: issue2, user: user2, name: 'star')