diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-27 11:16:07 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-27 11:16:07 +0000 |
commit | 3bdf0e2921c4cac46084834899302b25858e6bde (patch) | |
tree | f1272e4a21f232aaad5ac1e0a5254b13ce1df040 /spec | |
parent | 3553e36d169e18025a2409b7055fff082d89f630 (diff) | |
parent | c7e00aca2d68a15c901506f1af4242df92670b6a (diff) | |
download | gitlab-ce-3bdf0e2921c4cac46084834899302b25858e6bde.tar.gz |
Merge branch 'compare-api' into 'master'
Compare api
Fixes #1165
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/repositories_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb index 5a5222ed3c5..a902a1542cc 100644 --- a/spec/requests/api/repositories_spec.rb +++ b/spec/requests/api/repositories_spec.rb @@ -112,4 +112,43 @@ describe API::API, api: true do response.status.should == 404 end end + + describe 'GET /GET /projects/:id/repository/compare' do + it "should compare branches" do + get api("/projects/#{project.id}/repository/compare", user), from: 'master', to: 'simple_merge_request' + response.status.should == 200 + json_response['commits'].should be_present + json_response['diffs'].should be_present + end + + it "should compare tags" do + get api("/projects/#{project.id}/repository/compare", user), from: 'v1.0.1', to: 'v1.0.2' + response.status.should == 200 + json_response['commits'].should be_present + json_response['diffs'].should be_present + end + + it "should compare commits" do + get api("/projects/#{project.id}/repository/compare", user), from: 'b1e6a9dbf1c85', to: '1e689bfba395' + response.status.should == 200 + json_response['commits'].should be_empty + json_response['diffs'].should be_empty + json_response['compare_same_ref'].should be_false + end + + it "should compare commits in reverse order" do + get api("/projects/#{project.id}/repository/compare", user), from: '1e689bfba395', to: 'b1e6a9dbf1c85' + response.status.should == 200 + json_response['commits'].should be_present + json_response['diffs'].should be_present + end + + it "should compare same refs" do + get api("/projects/#{project.id}/repository/compare", user), from: 'master', to: 'master' + response.status.should == 200 + json_response['commits'].should be_empty + json_response['diffs'].should be_empty + json_response['compare_same_ref'].should be_true + end + end end |