diff options
Diffstat (limited to 'spec/requests/api/protected_tags_spec.rb')
-rw-r--r-- | spec/requests/api/protected_tags_spec.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/requests/api/protected_tags_spec.rb b/spec/requests/api/protected_tags_spec.rb index 5a962cd5667..3bc8ecbee73 100644 --- a/spec/requests/api/protected_tags_spec.rb +++ b/spec/requests/api/protected_tags_spec.rb @@ -19,7 +19,7 @@ describe API::ProtectedTags do it 'returns the protected tags' do get api(route, user), params: { per_page: 100 } - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(response).to include_pagination_headers expect(json_response).to be_an Array @@ -55,7 +55,7 @@ describe API::ProtectedTags do it 'returns the protected tag' do get api(route, user) - expect(response).to have_gitlab_http_status(200) + expect(response).to have_gitlab_http_status(:ok) expect(json_response['name']).to eq(tag_name) expect(json_response['create_access_levels'][0]['access_level']).to eq(::Gitlab::Access::MAINTAINER) end @@ -106,7 +106,7 @@ describe API::ProtectedTags do it 'protects a single tag with maintainers can create tags' do post api("/projects/#{project.id}/protected_tags", user), params: { name: tag_name } - expect(response).to have_gitlab_http_status(201) + expect(response).to have_gitlab_http_status(:created) expect(json_response['name']).to eq(tag_name) expect(json_response['create_access_levels'][0]['access_level']).to eq(Gitlab::Access::MAINTAINER) end @@ -115,7 +115,7 @@ describe API::ProtectedTags do post api("/projects/#{project.id}/protected_tags", user), params: { name: tag_name, create_access_level: 30 } - expect(response).to have_gitlab_http_status(201) + expect(response).to have_gitlab_http_status(:created) expect(json_response['name']).to eq(tag_name) expect(json_response['create_access_levels'][0]['access_level']).to eq(Gitlab::Access::DEVELOPER) end @@ -124,7 +124,7 @@ describe API::ProtectedTags do post api("/projects/#{project.id}/protected_tags", user), params: { name: tag_name, create_access_level: 0 } - expect(response).to have_gitlab_http_status(201) + expect(response).to have_gitlab_http_status(:created) expect(json_response['name']).to eq(tag_name) expect(json_response['create_access_levels'][0]['access_level']).to eq(Gitlab::Access::NO_ACCESS) end @@ -132,7 +132,7 @@ describe API::ProtectedTags do it 'returns a 422 error if the same tag is protected twice' do post api("/projects/#{project.id}/protected_tags", user), params: { name: protected_name } - expect(response).to have_gitlab_http_status(422) + expect(response).to have_gitlab_http_status(:unprocessable_entity) expect(json_response['message'][0]).to eq('Name has already been taken') end @@ -140,7 +140,7 @@ describe API::ProtectedTags do post api("/projects/#{project.id}/protected_tags", user), params: { name: protected_name } post api("/projects/#{project2.id}/protected_tags", user), params: { name: protected_name } - expect(response).to have_gitlab_http_status(201) + expect(response).to have_gitlab_http_status(:created) expect(json_response['name']).to eq(protected_name) end @@ -150,7 +150,7 @@ describe API::ProtectedTags do it 'protects multiple tags with a wildcard in the name' do post api("/projects/#{project.id}/protected_tags", user), params: { name: tag_name } - expect(response).to have_gitlab_http_status(201) + expect(response).to have_gitlab_http_status(:created) expect(json_response['name']).to eq(tag_name) expect(json_response['create_access_levels'][0]['access_level']).to eq(Gitlab::Access::MAINTAINER) end @@ -165,7 +165,7 @@ describe API::ProtectedTags do it 'returns a 403 error if guest' do post api("/projects/#{project.id}/protected_tags/", user), params: { name: tag_name } - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(:forbidden) end end end @@ -178,7 +178,7 @@ describe API::ProtectedTags do it 'unprotects a single tag' do delete api("/projects/#{project.id}/protected_tags/#{tag_name}", user) - expect(response).to have_gitlab_http_status(204) + expect(response).to have_gitlab_http_status(:no_content) end it_behaves_like '412 response' do @@ -188,7 +188,7 @@ describe API::ProtectedTags do it "returns 404 if tag does not exist" do delete api("/projects/#{project.id}/protected_tags/barfoo", user) - expect(response).to have_gitlab_http_status(404) + expect(response).to have_gitlab_http_status(:not_found) end context 'when tag has a wildcard in its name' do @@ -197,7 +197,7 @@ describe API::ProtectedTags do it 'unprotects a wildcard tag' do delete api("/projects/#{project.id}/protected_tags/#{tag_name}", user) - expect(response).to have_gitlab_http_status(204) + expect(response).to have_gitlab_http_status(:no_content) end end end |