summaryrefslogtreecommitdiff
path: root/spec/api
diff options
context:
space:
mode:
authorJeremy Anderson <jeremy@code-adept.com>2012-07-26 07:29:53 -0700
committerJeremy Anderson <jeremy@code-adept.com>2012-07-31 07:32:44 -0700
commit69c4cea65a7ba13469f43914fbdccf592053fec8 (patch)
treea93056eb77da46e7fd7d6aecca27938a82b172c5 /spec/api
parente6edaa3b502090f461b58c439ea476da2d37f039 (diff)
downloadgitlab-ce-69c4cea65a7ba13469f43914fbdccf592053fec8.tar.gz
updating project api to include raw blob contents and single branch
Diffstat (limited to 'spec/api')
-rw-r--r--spec/api/projects_spec.rb32
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/api/projects_spec.rb b/spec/api/projects_spec.rb
index 8852a0d346b..2b50b6d0ec7 100644
--- a/spec/api/projects_spec.rb
+++ b/spec/api/projects_spec.rb
@@ -53,6 +53,16 @@ describe Gitlab::API do
end
end
+ describe "GET /projects/:id/repository/branches/:branch" do
+ it "should return the branch information for a single branch" do
+ get "#{api_prefix}/projects/#{project.code}/repository/branches/new_design?private_token=#{user.private_token}"
+ response.status.should == 200
+
+ json_response['name'].should == 'new_design'
+ json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1'
+ end
+ end
+
describe "GET /projects/:id/repository/tags" do
it "should return an array of project tags" do
get "#{api_prefix}/projects/#{project.code}/repository/tags?private_token=#{user.private_token}"
@@ -93,7 +103,7 @@ describe Gitlab::API do
it "should delete existing project snippet" do
expect {
delete "#{api_prefix}/projects/#{project.code}/snippets/#{snippet.id}?private_token=#{user.private_token}"
- }.should change { Snippet.count }.by(-1)
+ }.to change { Snippet.count }.by(-1)
end
end
@@ -103,4 +113,24 @@ describe Gitlab::API do
response.status.should == 200
end
end
+
+ describe "GET /projects/:id/:sha/blob" do
+ it "should get the raw file contents" do
+ get "#{api_prefix}/projects/#{project.code}/repository/commits/master/blob?filepath=README.md&private_token=#{user.private_token}"
+
+ response.status.should == 200
+ end
+
+ it "should return 404 for invalid branch_name" do
+ get "#{api_prefix}/projects/#{project.code}/repository/commits/invalid_branch_name/blob?filepath=README.md&private_token=#{user.private_token}"
+
+ response.status.should == 404
+ end
+
+ it "should return 404 for invalid file" do
+ get "#{api_prefix}/projects/#{project.code}/repository/commits/master/blob?filepath=README.invalid&private_token=#{user.private_token}"
+
+ response.status.should == 404
+ end
+ end
end