diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-09-05 14:05:30 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-09-05 14:05:30 +0300 |
commit | 960b8cd46094fd5ff8ac11267a6998af8d97ee22 (patch) | |
tree | f5c39b11f16faeac6eea16165b26ebfc2bfd6afe /spec/requests | |
parent | f19910b56dea355b7606d38dbda07ab93bcbaad3 (diff) | |
parent | 02aa269e34b7c05a52e5226fc02d91ffbbb6010f (diff) |
Merge branch 'api_branches_head' into 'master'
Add branch existence check to the APIv4 branches via HEAD request
Closes #37159
See merge request !13979
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/branches_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index b1e011de604..cc794fad3a7 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -75,6 +75,22 @@ describe API::Branches do let(:route) { "/projects/#{project_id}/repository/branches/#{branch_name}" } shared_examples_for 'repository branch' do + context 'HEAD request' do + it 'returns 204 No Content' do + head api(route, user) + + expect(response).to have_gitlab_http_status(204) + expect(response.body).to be_empty + end + + it 'returns 404 Not Found' do + head api("/projects/#{project_id}/repository/branches/unknown", user) + + expect(response).to have_gitlab_http_status(404) + expect(response.body).to be_empty + end + end + it 'returns the repository branch' do get api(route, current_user) |