Return errors in API playlists/create

This commit is contained in:
Thibault Jouan 2015-05-04 01:01:37 +00:00
parent 8f8cdaec79
commit 5f993e4bd3
2 changed files with 7 additions and 1 deletions

View File

@ -14,7 +14,7 @@ module API
if @playlist.save
render :show, status: :created
else
render json: :nothing, status: :unprocessable_entity
render json: @playlist.errors, status: :unprocessable_entity
end
end

View File

@ -47,6 +47,12 @@ describe 'API playlists' do
it 'responds with unprocessable entity status' do
expect(response).to have_http_status 422
end
it 'returns errors' do
expect(json 422).to match(
name: [an_instance_of(String)]
)
end
end
end