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:
authorGabor Nagy <mail@aigeruth.hu>2013-08-26 01:21:00 +0400
committerGabor Nagy <mail@aigeruth.hu>2013-08-26 01:48:11 +0400
commitd139cc6b3283cef8f14660738d423ea63317203c (patch)
tree8de146b9f07a4aa74f40d0c48cfac156783747e8 /spec
parent2b36dee64485062c69779217d4a202e5ca1b67bd (diff)
Adds feature: get a diff via API.
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/repositories_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb
index afa67d1ecbe..44892876ccb 100644
--- a/spec/requests/api/repositories_spec.rb
+++ b/spec/requests/api/repositories_spec.rb
@@ -112,6 +112,28 @@ describe API::API do
end
end
+ describe "GET /projects:id/repository/commit/:sha" do
+ context "authorized user" do
+ before { project.team << [user2, :reporter] }
+
+ it "should return the diff of the selected commit" do
+ get api("/projects/#{project.id}/repository/commit/#{project.repository.commit.id}", user)
+ response.status.should == 200
+
+ json_response.should be_an Array
+ json_response.length.should >= 1
+ json_response.first.keys.should include "diff"
+ end
+ end
+
+ context "unauthorized user" do
+ it "should not return the diff of the selected commit" do
+ get api("/projects/#{project.id}/repository/commit/#{project.repository.commit.id}")
+ response.status.should == 401
+ end
+ end
+ end
+
describe "GET /projects/:id/repository/tree" do
context "authorized user" do
before { project.team << [user2, :reporter] }