Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author🙈 jacopo beschi 🙉 <intrip@gmail.com>2018-09-05 16:07:02 +0300
committerDouwe Maan <douwe@gitlab.com>2018-09-05 16:07:02 +0300
commit20bd1e6b34417a2b9f688071e2891a64d1653770 (patch)
tree88c9bb554659f57e4ffb23d657aa69d6ceea534e /spec/requests/api/merge_requests_spec.rb
parentcff47b2045999ba5ab1af7cf8c0aa45b2c52fb36 (diff)
Resolve "Return how many commits the source branch is behind the target branch through the API"
Diffstat (limited to 'spec/requests/api/merge_requests_spec.rb')
-rw-r--r--spec/requests/api/merge_requests_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 4de834bf93a..e987eee6e91 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -353,6 +353,15 @@ describe API::MergeRequests do
end
end
+ it 'returns the commits behind the target branch when include_diverged_commits_count is present' do
+ allow_any_instance_of(merge_request.class).to receive(:diverged_commits_count).and_return(1)
+
+ get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}", user), include_diverged_commits_count: true
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['diverged_commits_count']).to eq(1)
+ end
+
it "returns a 404 error if merge_request_iid not found" do
get api("/projects/#{project.id}/merge_requests/999", user)
expect(response).to have_gitlab_http_status(404)