Commit c47aea75 authored by JB Vasseur's avatar JB Vasseur

Use have_gitlab_http_status following best practices !22296

parent abf7c10b
...@@ -16,7 +16,7 @@ describe API::Applications, :api do ...@@ -16,7 +16,7 @@ describe API::Applications, :api do
application = Doorkeeper::Application.find_by(name: 'application_name', redirect_uri: 'http://application.url') application = Doorkeeper::Application.find_by(name: 'application_name', redirect_uri: 'http://application.url')
expect(response).to have_http_status 201 expect(response).to have_gitlab_http_status(201)
expect(json_response).to be_a Hash expect(json_response).to be_a Hash
expect(json_response['application_id']).to eq application.uid expect(json_response['application_id']).to eq application.uid
expect(json_response['secret']).to eq application.secret expect(json_response['secret']).to eq application.secret
...@@ -28,7 +28,7 @@ describe API::Applications, :api do ...@@ -28,7 +28,7 @@ describe API::Applications, :api do
post api('/applications', admin_user), name: 'application_name', redirect_uri: 'wrong_url_format', scopes: '' post api('/applications', admin_user), name: 'application_name', redirect_uri: 'wrong_url_format', scopes: ''
end.not_to change { Doorkeeper::Application.count } end.not_to change { Doorkeeper::Application.count }
expect(response).to have_http_status 400 expect(response).to have_gitlab_http_status(400)
expect(json_response).to be_a Hash expect(json_response).to be_a Hash
expect(json_response['message']['redirect_uri'][0]).to eq('must be an absolute URI.') expect(json_response['message']['redirect_uri'][0]).to eq('must be an absolute URI.')
end end
...@@ -38,7 +38,7 @@ describe API::Applications, :api do ...@@ -38,7 +38,7 @@ describe API::Applications, :api do
post api('/applications', admin_user), redirect_uri: 'http://application.url', scopes: '' post api('/applications', admin_user), redirect_uri: 'http://application.url', scopes: ''
end.not_to change { Doorkeeper::Application.count } end.not_to change { Doorkeeper::Application.count }
expect(response).to have_http_status 400 expect(response).to have_gitlab_http_status(400)
expect(json_response).to be_a Hash expect(json_response).to be_a Hash
expect(json_response['error']).to eq('name is missing') expect(json_response['error']).to eq('name is missing')
end end
...@@ -48,7 +48,7 @@ describe API::Applications, :api do ...@@ -48,7 +48,7 @@ describe API::Applications, :api do
post api('/applications', admin_user), name: 'application_name', scopes: '' post api('/applications', admin_user), name: 'application_name', scopes: ''
end.not_to change { Doorkeeper::Application.count } end.not_to change { Doorkeeper::Application.count }
expect(response).to have_http_status 400 expect(response).to have_gitlab_http_status(400)
expect(json_response).to be_a Hash expect(json_response).to be_a Hash
expect(json_response['error']).to eq('redirect_uri is missing') expect(json_response['error']).to eq('redirect_uri is missing')
end end
...@@ -58,7 +58,7 @@ describe API::Applications, :api do ...@@ -58,7 +58,7 @@ describe API::Applications, :api do
post api('/applications', admin_user), name: 'application_name', redirect_uri: 'http://application.url' post api('/applications', admin_user), name: 'application_name', redirect_uri: 'http://application.url'
end.not_to change { Doorkeeper::Application.count } end.not_to change { Doorkeeper::Application.count }
expect(response).to have_http_status 400 expect(response).to have_gitlab_http_status(400)
expect(json_response).to be_a Hash expect(json_response).to be_a Hash
expect(json_response['error']).to eq('scopes is missing') expect(json_response['error']).to eq('scopes is missing')
end end
...@@ -70,7 +70,7 @@ describe API::Applications, :api do ...@@ -70,7 +70,7 @@ describe API::Applications, :api do
post api('/applications', user), name: 'application_name', redirect_uri: 'http://application.url', scopes: '' post api('/applications', user), name: 'application_name', redirect_uri: 'http://application.url', scopes: ''
end.not_to change { Doorkeeper::Application.count } end.not_to change { Doorkeeper::Application.count }
expect(response).to have_http_status 403 expect(response).to have_gitlab_http_status(403)
end end
end end
...@@ -80,7 +80,7 @@ describe API::Applications, :api do ...@@ -80,7 +80,7 @@ describe API::Applications, :api do
post api('/applications'), name: 'application_name', redirect_uri: 'http://application.url' post api('/applications'), name: 'application_name', redirect_uri: 'http://application.url'
end.not_to change { Doorkeeper::Application.count } end.not_to change { Doorkeeper::Application.count }
expect(response).to have_http_status 401 expect(response).to have_gitlab_http_status(401)
end end
end end
end end
...@@ -99,7 +99,7 @@ describe API::Applications, :api do ...@@ -99,7 +99,7 @@ describe API::Applications, :api do
it 'cannot list application' do it 'cannot list application' do
get api('/applications', user) get api('/applications', user)
expect(response).to have_http_status 403 expect(response).to have_gitlab_http_status(403)
end end
end end
...@@ -107,7 +107,7 @@ describe API::Applications, :api do ...@@ -107,7 +107,7 @@ describe API::Applications, :api do
it 'cannot list application' do it 'cannot list application' do
get api('/applications') get api('/applications')
expect(response).to have_http_status 401 expect(response).to have_gitlab_http_status(401)
end end
end end
end end
...@@ -127,7 +127,7 @@ describe API::Applications, :api do ...@@ -127,7 +127,7 @@ describe API::Applications, :api do
it 'cannot delete an application' do it 'cannot delete an application' do
delete api("/applications/#{application.id}", user) delete api("/applications/#{application.id}", user)
expect(response).to have_http_status 403 expect(response).to have_gitlab_http_status(403)
end end
end end
...@@ -135,7 +135,7 @@ describe API::Applications, :api do ...@@ -135,7 +135,7 @@ describe API::Applications, :api do
it 'cannot delete an application' do it 'cannot delete an application' do
delete api("/applications/#{application.id}") delete api("/applications/#{application.id}")
expect(response).to have_http_status 401 expect(response).to have_gitlab_http_status(401)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment