diff options
author | Gabor Nagy <mail@aigeruth.hu> | 2013-08-25 23:21:00 +0200 |
---|---|---|
committer | Gabor Nagy <mail@aigeruth.hu> | 2013-08-25 23:48:11 +0200 |
commit | d139cc6b3283cef8f14660738d423ea63317203c (patch) | |
tree | 8de146b9f07a4aa74f40d0c48cfac156783747e8 /spec/requests | |
parent | 2b36dee64485062c69779217d4a202e5ca1b67bd (diff) | |
download | gitlab-ce-d139cc6b3283cef8f14660738d423ea63317203c.tar.gz |
Adds feature: get a diff via API.
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/repositories_spec.rb | 22 |
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] } |