summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorjubianchi <contact@jubianchi.fr>2015-01-18 22:17:10 +0100
committerjubianchi <contact@jubianchi.fr>2015-01-19 14:13:30 +0100
commit39e54e21cb5dfaddaf4c83bc4509c951675091ea (patch)
tree0ad76117a7a8433e5dfa952d4f666aac6307f468 /spec/requests
parent2fba31890e922fa8bae61e7aa3f21c5b4314e735 (diff)
downloadgitlab-ce-39e54e21cb5dfaddaf4c83bc4509c951675091ea.tar.gz
Handle errors on API when a project does not have a repository (Closes #6289)
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/repositories_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb
index beae71c02d9..5518d2df566 100644
--- a/spec/requests/api/repositories_spec.rb
+++ b/spec/requests/api/repositories_spec.rb
@@ -101,6 +101,14 @@ describe API::API, api: true do
json_response.first['type'].should == 'tree'
json_response.first['mode'].should == '040000'
end
+
+ it 'should return a 404 for unknown ref' do
+ get api("/projects/#{project.id}/repository/tree?ref_name=foo", user)
+ response.status.should == 404
+
+ json_response.should be_an Object
+ json_response['message'] == '404 Tree Not Found'
+ end
end
context "unauthorized user" do
@@ -145,6 +153,14 @@ describe API::API, api: true do
get api("/projects/#{project.id}/repository/raw_blobs/#{sample_blob.oid}", user)
response.status.should == 200
end
+
+ it 'should return a 404 for unknown blob' do
+ get api("/projects/#{project.id}/repository/raw_blobs/123456", user)
+ response.status.should == 404
+
+ json_response.should be_an Object
+ json_response['message'] == '404 Blob Not Found'
+ end
end
describe "GET /projects/:id/repository/archive(.:format)?:sha" do