diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/requests/api/graphql/user_query_spec.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/requests/api/graphql/user_query_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/user_query_spec.rb | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/spec/requests/api/graphql/user_query_spec.rb b/spec/requests/api/graphql/user_query_spec.rb index 2f4dc0a9160..79debd0b7ef 100644 --- a/spec/requests/api/graphql/user_query_spec.rb +++ b/spec/requests/api/graphql/user_query_spec.rb @@ -29,15 +29,15 @@ RSpec.describe 'getting user information' do let_it_be(:unauthorized_user) { create(:user) } let_it_be(:assigned_mr) do - create(:merge_request, :unique_branches, + create(:merge_request, :unique_branches, :unique_author, source_project: project_a, assignees: [user]) end let_it_be(:assigned_mr_b) do - create(:merge_request, :unique_branches, + create(:merge_request, :unique_branches, :unique_author, source_project: project_b, assignees: [user]) end let_it_be(:assigned_mr_c) do - create(:merge_request, :unique_branches, + create(:merge_request, :unique_branches, :unique_author, source_project: project_b, assignees: [user]) end let_it_be(:authored_mr) do @@ -133,6 +133,17 @@ RSpec.describe 'getting user information' do ) end end + + context 'filtering by author' do + let(:author) { assigned_mr_b.author } + let(:mr_args) { { author_username: author.username } } + + it 'finds the authored mrs' do + expect(assigned_mrs).to contain_exactly( + a_hash_including('id' => global_id_of(assigned_mr_b)) + ) + end + end end context 'the current user does not have access' do @@ -172,6 +183,23 @@ RSpec.describe 'getting user information' do end end + context 'filtering by assignee' do + let(:assignee) { create(:user) } + let(:mr_args) { { assignee_username: assignee.username } } + + it 'finds the assigned mrs' do + authored_mr.assignees << assignee + authored_mr_c.assignees << assignee + + post_graphql(query, current_user: current_user) + + expect(authored_mrs).to contain_exactly( + a_hash_including('id' => global_id_of(authored_mr)), + a_hash_including('id' => global_id_of(authored_mr_c)) + ) + end + end + context 'filtering by project path and IID' do let(:mr_args) do { project_path: project_b.full_path, iids: [authored_mr_b.iid.to_s] } @@ -253,8 +281,10 @@ RSpec.describe 'getting user information' do let(:current_user) { user } it 'can be found' do - expect(assigned_mrs).to include( - a_hash_including('id' => global_id_of(assigned_mr)) + expect(assigned_mrs).to contain_exactly( + a_hash_including('id' => global_id_of(assigned_mr)), + a_hash_including('id' => global_id_of(assigned_mr_b)), + a_hash_including('id' => global_id_of(assigned_mr_c)) ) end end |