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
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-27 15:16:07 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-27 15:16:07 +0400
commit3bdf0e2921c4cac46084834899302b25858e6bde (patch)
treef1272e4a21f232aaad5ac1e0a5254b13ce1df040 /spec
parent3553e36d169e18025a2409b7055fff082d89f630 (diff)
parentc7e00aca2d68a15c901506f1af4242df92670b6a (diff)
Merge branch 'compare-api' into 'master'
Compare api Fixes #1165
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/repositories_spec.rb39
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