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
Jérome Perrin
gitlab-ce
Commits
ee4820a5
Commit
ee4820a5
authored
Aug 28, 2017
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a spec when ressource is not modified
parent
8bd9fb4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
8 deletions
+22
-8
lib/api/projects.rb
lib/api/projects.rb
+2
-4
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+2
-0
spec/support/shared_examples/requests/api/status_shared_examples.rb
...rt/shared_examples/requests/api/status_shared_examples.rb
+18
-4
No files found.
lib/api/projects.rb
View file @
ee4820a5
...
...
@@ -365,8 +365,7 @@ module API
authorize!
:remove_fork_project
,
user_project
if
user_project
.
forked?
status
204
user_project
.
forked_project_link
.
destroy
destroy_conditionally!
(
user_project
.
forked_project_link
)
else
not_modified!
end
...
...
@@ -410,8 +409,7 @@ module API
link
=
user_project
.
project_group_links
.
find_by
(
group_id:
params
[
:group_id
])
not_found!
(
'Group Link'
)
unless
link
status
204
link
.
destroy
destroy_conditionally!
(
link
)
end
desc
'Upload a file'
...
...
spec/requests/api/projects_spec.rb
View file @
ee4820a5
...
...
@@ -1541,6 +1541,7 @@ describe API::Projects do
end
it_behaves_like
'412 response'
do
let
(
:success_status
)
{
202
}
let
(
:request
)
{
api
(
"/projects/
#{
project
.
id
}
"
,
user
)
}
end
...
...
@@ -1576,6 +1577,7 @@ describe API::Projects do
end
it_behaves_like
'412 response'
do
let
(
:success_status
)
{
202
}
let
(
:request
)
{
api
(
"/projects/
#{
project
.
id
}
"
,
admin
)
}
end
end
...
...
spec/support/shared_examples/requests/api/status_shared_examples.rb
View file @
ee4820a5
...
...
@@ -43,11 +43,25 @@ end
shared_examples_for
'412 response'
do
let
(
:params
)
{
nil
}
before
do
delete
request
,
params
,
{
'HTTP_IF_UNMODIFIED_SINCE'
=>
'1990-01-12T00:00:48-0600'
}
let
(
:success_status
)
{
204
}
context
'for a modified ressource'
do
before
do
delete
request
,
params
,
{
'HTTP_IF_UNMODIFIED_SINCE'
=>
'1990-01-12T00:00:48-0600'
}
end
it
'returns 412'
do
expect
(
response
).
to
have_gitlab_http_status
(
412
)
end
end
it
'returns 412'
do
expect
(
response
).
to
have_gitlab_http_status
(
412
)
context
'for an unmodified ressource'
do
before
do
delete
request
,
params
,
{
'HTTP_IF_UNMODIFIED_SINCE'
=>
Time
.
now
}
end
it
'returns accepted'
do
expect
(
response
).
to
have_gitlab_http_status
(
success_status
)
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