diff options
author | Maciej Nowak <maciejt.nowak@gmail.com> | 2018-06-23 21:39:11 +0200 |
---|---|---|
committer | Maciej Nowak <maciejt.nowak@gmail.com> | 2018-06-28 09:19:50 +0200 |
commit | 591edb439c2608f7448d7c3d5d2fc35e0ad5e8c1 (patch) | |
tree | 9219fc5db67b8d8aa8a40de5f01e27318728dc2a /spec/requests/api/repositories_spec.rb | |
parent | 2bac2918b2d6f12d94f739f4b6865b9e9221c642 (diff) | |
download | gitlab-ce-591edb439c2608f7448d7c3d5d2fc35e0ad5e8c1.tar.gz |
Allow straight diff in Compare API
Repository compare API now allows choosing straight (from..to) or merge-base diff (from...to)
Diffstat (limited to 'spec/requests/api/repositories_spec.rb')
-rw-r--r-- | spec/requests/api/repositories_spec.rb | 25 |
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' |