diff options
Diffstat (limited to 'spec/api/projects_spec.rb')
-rw-r--r-- | spec/api/projects_spec.rb | 32 |
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 |