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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
a2997ce1
Commit
a2997ce1
authored
Aug 21, 2018
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend to DELETE endpoint
parent
6dc4d1b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
spec/requests/api/files_spec.rb
spec/requests/api/files_spec.rb
+13
-5
No files found.
spec/requests/api/files_spec.rb
View file @
a2997ce1
...
...
@@ -450,7 +450,7 @@ describe API::Files do
end
describe
"DELETE /projects/:id/repository/files"
do
let
(
:
valid_
params
)
do
let
(
:params
)
do
{
branch:
'master'
,
commit_message:
'Changed file'
...
...
@@ -458,7 +458,7 @@ describe API::Files do
end
it
"deletes existing file in project repo"
do
delete
api
(
route
(
file_path
),
user
),
valid_
params
delete
api
(
route
(
file_path
),
user
),
params
expect
(
response
).
to
have_gitlab_http_status
(
204
)
end
...
...
@@ -469,19 +469,27 @@ describe API::Files do
expect
(
response
).
to
have_gitlab_http_status
(
400
)
end
it
'returns a 400 bad request if the commit message is empty'
do
params
[
:commit_message
]
=
''
delete
api
(
route
(
file_path
),
user
),
params
expect
(
response
).
to
have_gitlab_http_status
(
400
)
end
it
"returns a 400 if fails to delete file"
do
allow_any_instance_of
(
Repository
).
to
receive
(
:delete_file
).
and_raise
(
Gitlab
::
Git
::
CommitError
,
'Cannot delete file'
)
delete
api
(
route
(
file_path
),
user
),
valid_
params
delete
api
(
route
(
file_path
),
user
),
params
expect
(
response
).
to
have_gitlab_http_status
(
400
)
end
context
"when specifying an author"
do
it
"removes a file with the specified author"
do
valid_
params
.
merge!
(
author_email:
author_email
,
author_name:
author_name
)
params
.
merge!
(
author_email:
author_email
,
author_name:
author_name
)
delete
api
(
route
(
file_path
),
user
),
valid_
params
delete
api
(
route
(
file_path
),
user
),
params
expect
(
response
).
to
have_gitlab_http_status
(
204
)
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