diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2017-10-19 20:28:19 +0200 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2017-10-20 10:13:18 +0200 |
commit | 2f40dac35280f9de9af8c47bdf85c2f0b2d53680 (patch) | |
tree | ece7f87f18b32c8961e784973caf1dd299e877c7 /spec/requests/api/deploy_keys_spec.rb | |
parent | b4dc0ba2c57c150f847d255b0d2d831ff60728ad (diff) | |
download | gitlab-ce-2f40dac35280f9de9af8c47bdf85c2f0b2d53680.tar.gz |
Refactor `have_http_status` into `have_gitlab_http_status` in the specs
Diffstat (limited to 'spec/requests/api/deploy_keys_spec.rb')
-rw-r--r-- | spec/requests/api/deploy_keys_spec.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/requests/api/deploy_keys_spec.rb b/spec/requests/api/deploy_keys_spec.rb index 684877c33c0..1f1e6ea17e4 100644 --- a/spec/requests/api/deploy_keys_spec.rb +++ b/spec/requests/api/deploy_keys_spec.rb @@ -48,7 +48,7 @@ describe API::DeployKeys do it 'returns array of ssh keys' do get api("/projects/#{project.id}/deploy_keys", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.first['title']).to eq(deploy_key.title) @@ -59,14 +59,14 @@ describe API::DeployKeys do it 'returns a single key' do get api("/projects/#{project.id}/deploy_keys/#{deploy_key.id}", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['title']).to eq(deploy_key.title) end it 'returns 404 Not Found with invalid ID' do get api("/projects/#{project.id}/deploy_keys/404", admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -74,14 +74,14 @@ describe API::DeployKeys do it 'does not create an invalid ssh key' do post api("/projects/#{project.id}/deploy_keys", admin), { title: 'invalid key' } - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['error']).to eq('key is missing') end it 'does not create a key without title' do post api("/projects/#{project.id}/deploy_keys", admin), key: 'some key' - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['error']).to eq('title is missing') end @@ -98,7 +98,7 @@ describe API::DeployKeys do post api("/projects/#{project.id}/deploy_keys", admin), { key: deploy_key.key, title: deploy_key.title } end.not_to change { project.deploy_keys.count } - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) end it 'joins an existing ssh key to a new project' do @@ -106,7 +106,7 @@ describe API::DeployKeys do post api("/projects/#{project2.id}/deploy_keys", admin), { key: deploy_key.key, title: deploy_key.title } end.to change { project2.deploy_keys.count }.by(1) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) end it 'accepts can_push parameter' do @@ -114,7 +114,7 @@ describe API::DeployKeys do post api("/projects/#{project.id}/deploy_keys", admin), key_attrs - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['can_push']).to eq(true) end end @@ -130,7 +130,7 @@ describe API::DeployKeys do put api("/projects/#{project.id}/deploy_keys/#{deploy_key.id}", admin), { title: 'new title' } end.not_to change(deploy_key, :title) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) end it 'does not update a public deploy key as non admin' do @@ -138,7 +138,7 @@ describe API::DeployKeys do put api("/projects/#{project.id}/deploy_keys/#{deploy_key.id}", user), { title: 'new title' } end.not_to change(deploy_key, :title) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it 'does not update a private key with invalid title' do @@ -148,7 +148,7 @@ describe API::DeployKeys do put api("/projects/#{project.id}/deploy_keys/#{private_deploy_key.id}", admin), { title: '' } end.not_to change(deploy_key, :title) - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end it 'updates a private ssh key with correct attributes' do @@ -181,14 +181,14 @@ describe API::DeployKeys do expect do delete api("/projects/#{project.id}/deploy_keys/#{deploy_key.id}", admin) - expect(response).to have_http_status(204) + expect(response).to have_gitlab_http_status(204) end.to change { project.deploy_keys.count }.by(-1) end it 'returns 404 Not Found with invalid ID' do delete api("/projects/#{project.id}/deploy_keys/404", admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it_behaves_like '412 response' do @@ -205,7 +205,7 @@ describe API::DeployKeys do post api("/projects/#{project2.id}/deploy_keys/#{deploy_key.id}/enable", admin) end.to change { project2.deploy_keys.count }.from(0).to(1) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['id']).to eq(deploy_key.id) end end @@ -214,7 +214,7 @@ describe API::DeployKeys do it 'returns a 404 error' do post api("/projects/#{project2.id}/deploy_keys/#{deploy_key.id}/enable", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end |