diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
commit | f64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch) | |
tree | a2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /spec/graphql/types/merge_request_type_spec.rb | |
parent | bfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff) | |
download | gitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'spec/graphql/types/merge_request_type_spec.rb')
-rw-r--r-- | spec/graphql/types/merge_request_type_spec.rb | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/spec/graphql/types/merge_request_type_spec.rb b/spec/graphql/types/merge_request_type_spec.rb index 63d288934e5..3314ea62324 100644 --- a/spec/graphql/types/merge_request_type_spec.rb +++ b/spec/graphql/types/merge_request_type_spec.rb @@ -23,7 +23,7 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do merge_error allow_collaboration should_be_rebased rebase_commit_sha rebase_in_progress default_merge_commit_message merge_ongoing mergeable_discussions_state web_url - source_branch_exists target_branch_exists + source_branch_exists target_branch_exists diverged_from_target_branch upvotes downvotes head_pipeline pipelines task_completion_status milestone assignees reviewers participants subscribed labels discussion_locked time_estimate total_time_spent reference author merged_at commit_count current_user_todos @@ -77,4 +77,33 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do end end end + + describe '#diverged_from_target_branch' do + subject(:execute_query) { GitlabSchema.execute(query, context: { current_user: current_user }).as_json } + + let!(:merge_request) { create(:merge_request, target_project: project, source_project: project) } + let(:project) { create(:project, :public) } + let(:current_user) { create :admin } + let(:query) do + %( + { + project(fullPath: "#{project.full_path}") { + mergeRequests { + nodes { + divergedFromTargetBranch + } + } + } + } + ) + end + + it 'delegates the diverged_from_target_branch? call to the merge request entity' do + expect_next_found_instance_of(MergeRequest) do |instance| + expect(instance).to receive(:diverged_from_target_branch?) + end + + execute_query + end + end end |