diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/graphql/resolvers/issues_resolver_spec.rb | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/graphql/resolvers/issues_resolver_spec.rb')
-rw-r--r-- | spec/graphql/resolvers/issues_resolver_spec.rb | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/spec/graphql/resolvers/issues_resolver_spec.rb b/spec/graphql/resolvers/issues_resolver_spec.rb index 6e802bf7d25..7c2ceb50066 100644 --- a/spec/graphql/resolvers/issues_resolver_spec.rb +++ b/spec/graphql/resolvers/issues_resolver_spec.rb @@ -46,10 +46,6 @@ RSpec.describe Resolvers::IssuesResolver do expect(resolve_issues(milestone_title: [milestone.title])).to contain_exactly(issue1) end - it 'filters by assignee_username' do - expect(resolve_issues(assignee_username: [assignee.username])).to contain_exactly(issue2) - end - it 'filters by two assignees' do assignee2 = create(:user) issue2.update!(assignees: [assignee, assignee2]) @@ -78,6 +74,24 @@ RSpec.describe Resolvers::IssuesResolver do expect(resolve_issues(label_name: [label1.title, label2.title])).to contain_exactly(issue2) end + describe 'filters by assignee_username' do + it 'filters by assignee_username' do + expect(resolve_issues(assignee_username: [assignee.username])).to contain_exactly(issue2) + end + + it 'filters by assignee_usernames' do + expect(resolve_issues(assignee_usernames: [assignee.username])).to contain_exactly(issue2) + end + + context 'when both assignee_username and assignee_usernames are provided' do + it 'raises a mutually exclusive filter error' do + expect do + resolve_issues(assignee_usernames: [assignee.username], assignee_username: assignee.username) + end.to raise_error(Gitlab::Graphql::Errors::ArgumentError, 'only one of [assigneeUsernames, assigneeUsername] arguments is allowed at the same time.') + end + end + end + describe 'filters by created_at' do it 'filters by created_before' do expect(resolve_issues(created_before: 2.hours.ago)).to contain_exactly(issue1) @@ -144,6 +158,29 @@ RSpec.describe Resolvers::IssuesResolver do end end + describe 'filters by negated params' do + it 'returns issues without the specified iids' do + expect(resolve_issues(not: { iids: [issue1.iid] })).to contain_exactly(issue2) + end + + it 'returns issues without the specified label names' do + expect(resolve_issues(not: { label_name: [label1.title] })).to be_empty + expect(resolve_issues(not: { label_name: [label2.title] })).to contain_exactly(issue1) + end + + it 'returns issues without the specified milestone' do + expect(resolve_issues(not: { milestone_title: [milestone.title] })).to contain_exactly(issue2) + end + + it 'returns issues without the specified assignee_usernames' do + expect(resolve_issues(not: { assignee_usernames: [assignee.username] })).to contain_exactly(issue1) + end + + it 'returns issues without the specified assignee_id' do + expect(resolve_issues(not: { assignee_id: [assignee.id] })).to contain_exactly(issue1) + end + end + describe 'sorting' do context 'when sorting by created' do it 'sorts issues ascending' do |