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:
authorSean McGivern <sean@mcgivern.me.uk>2018-06-28 12:04:18 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-06-28 12:04:18 +0300
commit5e7988eeccd017f2948831bdaab3bbdbc2e2b544 (patch)
treecee16fdeff3c18a8bbb588e85e66d01d0ca349b1 /spec/requests
parent687278a6dd4296ecdd61028d4ad7ea3d2b2b7df3 (diff)
parent591edb439c2608f7448d7c3d5d2fc35e0ad5e8c1 (diff)
Merge branch 'straight-comparision-mode' into 'master'
Allow straight diff in Compare API See merge request gitlab-org/gitlab-ce!20120
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/repositories_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb
index cd135dfc32a..28f8564ae92 100644
--- a/spec/requests/api/repositories_spec.rb
+++ b/spec/requests/api/repositories_spec.rb
@@ -288,6 +288,9 @@ describe API::Repositories do
shared_examples_for 'repository compare' do
it "compares branches" do
+ expect(::Gitlab::Git::Compare).to receive(:new).with(anything, anything, anything, {
+ straight: false
+ }).and_call_original
get api(route, current_user), from: 'master', to: 'feature'
expect(response).to have_gitlab_http_status(200)
@@ -295,6 +298,28 @@ describe API::Repositories do
expect(json_response['diffs']).to be_present
end
+ it "compares branches with explicit merge-base mode" do
+ expect(::Gitlab::Git::Compare).to receive(:new).with(anything, anything, anything, {
+ straight: false
+ }).and_call_original
+ get api(route, current_user), from: 'master', to: 'feature', straight: false
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['commits']).to be_present
+ expect(json_response['diffs']).to be_present
+ end
+
+ it "compares branches with explicit straight mode" do
+ expect(::Gitlab::Git::Compare).to receive(:new).with(anything, anything, anything, {
+ straight: true
+ }).and_call_original
+ get api(route, current_user), from: 'master', to: 'feature', straight: true
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response['commits']).to be_present
+ expect(json_response['diffs']).to be_present
+ end
+
it "compares tags" do
get api(route, current_user), from: 'v1.0.0', to: 'v1.1.0'