API: Return 400 when creating a systemhook fails
This commit is contained in:
parent
c392b0cc24
commit
659ef54605
3 changed files with 11 additions and 1 deletions
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Return 400 when creating a system hook fails
|
||||
merge_request: 7350
|
||||
author: Robert Schilling
|
|
@ -32,7 +32,7 @@ module API
|
|||
if hook.save
|
||||
present hook, with: Entities::Hook
|
||||
else
|
||||
not_found!
|
||||
render_validation_error!(hook)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -52,6 +52,12 @@ describe API::API, api: true do
|
|||
expect(response).to have_http_status(400)
|
||||
end
|
||||
|
||||
it "responds with 400 if url is invalid" do
|
||||
post api("/hooks", admin), url: 'hp://mep.mep'
|
||||
|
||||
expect(response).to have_http_status(400)
|
||||
end
|
||||
|
||||
it "does not create new hook without url" do
|
||||
expect do
|
||||
post api("/hooks", admin)
|
||||
|
|
Loading…
Reference in a new issue