diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-14 12:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-14 12:09:34 +0300 |
commit | 97f0ae7454597105a27df65ffb772949d9d4f3cb (patch) | |
tree | 0bf4888e0e9082c8f168a211390a73a6ae810cef /spec/requests | |
parent | 5ebc4d92cd5fbb46c627eb04d500384893dbe2b4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/graphql/project/merge_request/diff_notes_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/graphql/project/merge_request_spec.rb | 37 |
2 files changed, 38 insertions, 1 deletions
diff --git a/spec/requests/api/graphql/project/merge_request/diff_notes_spec.rb b/spec/requests/api/graphql/project/merge_request/diff_notes_spec.rb index e260e4463f4..c616310a72c 100644 --- a/spec/requests/api/graphql/project/merge_request/diff_notes_spec.rb +++ b/spec/requests/api/graphql/project/merge_request/diff_notes_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' describe 'getting notes for a merge request' do include GraphqlHelpers - let(:noteable) { create(:merge_request) } + let_it_be(:noteable) { create(:merge_request) } def noteable_query(noteable_fields) <<~QRY diff --git a/spec/requests/api/graphql/project/merge_request_spec.rb b/spec/requests/api/graphql/project/merge_request_spec.rb index e1fe6470881..a1b3111ff71 100644 --- a/spec/requests/api/graphql/project/merge_request_spec.rb +++ b/spec/requests/api/graphql/project/merge_request_spec.rb @@ -93,4 +93,41 @@ describe 'getting merge request information nested in a project' do expect(merge_request_graphql_data['pipelines']['edges'].size).to eq(1) end end + + context 'when limiting the number of results' do + let(:merge_requests_graphql_data) { graphql_data['project']['mergeRequests']['edges'] } + + let!(:merge_requests) do + [ + create(:merge_request, source_project: project, source_branch: 'branch-1'), + create(:merge_request, source_project: project, source_branch: 'branch-2'), + create(:merge_request, source_project: project, source_branch: 'branch-3') + ] + end + + let(:fields) do + <<~QUERY + edges { + node { + iid, + title + } + } + QUERY + end + + let(:query) do + graphql_query_for( + 'project', + { 'fullPath' => project.full_path }, + "mergeRequests(first: 2) { #{fields} }" + ) + end + + it 'returns the correct number of results' do + post_graphql(query, current_user: current_user) + + expect(merge_requests_graphql_data.size).to eq 2 + end + end end |