Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
04593581
Commit
04593581
authored
Oct 13, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Fix Sytem hooks delete behavior
parent
fbeaa751
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
14 deletions
+10
-14
doc/api/system_hooks.md
doc/api/system_hooks.md
+2
-5
lib/api/system_hooks.rb
lib/api/system_hooks.rb
+4
-6
spec/requests/api/system_hooks_spec.rb
spec/requests/api/system_hooks_spec.rb
+4
-3
No files found.
doc/api/system_hooks.md
View file @
04593581
...
...
@@ -98,11 +98,8 @@ Example response:
## Delete system hook
Deletes a system hook. This is an idempotent API function and returns
`200 OK`
even if the hook is not available.
If the hook is deleted, a JSON object is returned. An error is raised if the
hook is not found.
Deletes a system hook. It returns
`200 OK`
if the hooks is deleted and
`404 Not Found`
if the hook is not found.
---
...
...
lib/api/system_hooks.rb
View file @
04593581
...
...
@@ -56,12 +56,10 @@ module API
requires
:id
,
type:
Integer
,
desc:
'The ID of the system hook'
end
delete
":id"
do
begin
hook
=
SystemHook
.
find
(
params
[
:id
])
hook
=
SystemHook
.
find_by
(
id:
params
[
:id
])
not_found!
(
'System hook'
)
unless
hook
present
hook
.
destroy
,
with:
Entities
::
Hook
rescue
# SystemHook raises an Error if no hook with id found
end
end
end
end
...
...
spec/requests/api/system_hooks_spec.rb
View file @
04593581
...
...
@@ -73,9 +73,10 @@ describe API::API, api: true do
end
.
to
change
{
SystemHook
.
count
}.
by
(
-
1
)
end
it
"returns success if hook id not found"
do
delete
api
(
"/hooks/12345"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
it
'returns 404 if the system hook does not exist'
do
delete
api
(
'/hooks/12345'
,
admin
)
expect
(
response
).
to
have_http_status
(
404
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment