Refactor response status expectations in API UAT

This commit is contained in:
Thibault Jouan 2015-05-06 02:27:50 +00:00
parent a2488980ed
commit 1588417559

View File

@ -12,7 +12,7 @@ describe 'API application' do
it 'responds with a 406 when request format is not JSON' do it 'responds with a 406 when request format is not JSON' do
get api_ping_path, format: :xml get api_ping_path, format: :xml
expect(response.status).to be 406 expect(response).to have_http_status 406
expect(response.content_type).to eq :json expect(response.content_type).to eq :json
expect(response.body).to be_empty expect(response.body).to be_empty
end end
@ -23,13 +23,13 @@ describe 'API application' do
it 'responds with a 404 when route does not exist' do it 'responds with a 404 when route does not exist' do
get '/api/not_found', format: :json get '/api/not_found', format: :json
expect(response.status).to be 404 expect(response).to have_http_status 404
expect(response.body).to be_empty expect(response.body).to be_empty
end end
it 'responds with a 404 when a resource (AR) was not found' do it 'responds with a 404 when a resource (AR) was not found' do
get api_playlist_path(id: 1), format: :json get api_playlist_path(id: 1), format: :json
expect(response.status).to be 404 expect(response).to have_http_status 404
expect(response.body).to be_empty expect(response.body).to be_empty
end end
end end