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
578adc9b
Commit
578adc9b
authored
Jun 02, 2017
by
Athar Hameed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix missing optional path parameter in "Create project for user" API
parent
5cb8ad6c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
5 deletions
+26
-5
changelogs/unreleased/33242-create-project-for-user-api-ignores-path-parameter.yml
...42-create-project-for-user-api-ignores-path-parameter.yml
+4
-0
lib/api/projects.rb
lib/api/projects.rb
+1
-0
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+21
-5
No files found.
changelogs/unreleased/33242-create-project-for-user-api-ignores-path-parameter.yml
0 → 100644
View file @
578adc9b
---
title
:
Fix missing optional path parameter in "Create project for user" API
merge_request
:
11868
author
:
lib/api/projects.rb
View file @
578adc9b
...
@@ -129,6 +129,7 @@ module API
...
@@ -129,6 +129,7 @@ module API
params
do
params
do
requires
:name
,
type:
String
,
desc:
'The name of the project'
requires
:name
,
type:
String
,
desc:
'The name of the project'
requires
:user_id
,
type:
Integer
,
desc:
'The ID of a user'
requires
:user_id
,
type:
Integer
,
desc:
'The ID of a user'
optional
:path
,
type:
String
,
desc:
'The path of the repository'
optional
:default_branch
,
type:
String
,
desc:
'The default branch of the project'
optional
:default_branch
,
type:
String
,
desc:
'The default branch of the project'
use
:optional_params
use
:optional_params
use
:create_params
use
:create_params
...
...
spec/requests/api/projects_spec.rb
View file @
578adc9b
...
@@ -316,15 +316,15 @@ describe API::Projects do
...
@@ -316,15 +316,15 @@ describe API::Projects do
expect
(
project
.
path
).
to
eq
(
'foo_project'
)
expect
(
project
.
path
).
to
eq
(
'foo_project'
)
end
end
it
'creates new project name and path and returns 201'
do
it
'creates new project
with
name and path and returns 201'
do
expect
{
post
api
(
'/projects'
,
user
),
path:
'
foo-Project
'
,
name:
'Foo Project'
}.
expect
{
post
api
(
'/projects'
,
user
),
path:
'
path-project-Foo
'
,
name:
'Foo Project'
}.
to
change
{
Project
.
count
}.
by
(
1
)
to
change
{
Project
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_http_status
(
201
)
project
=
Project
.
first
project
=
Project
.
first
expect
(
project
.
name
).
to
eq
(
'Foo Project'
)
expect
(
project
.
name
).
to
eq
(
'Foo Project'
)
expect
(
project
.
path
).
to
eq
(
'
foo-Project
'
)
expect
(
project
.
path
).
to
eq
(
'
path-project-Foo
'
)
end
end
it
'creates last project before reaching project limit'
do
it
'creates last project before reaching project limit'
do
...
@@ -470,9 +470,25 @@ describe API::Projects do
...
@@ -470,9 +470,25 @@ describe API::Projects do
before
{
project
}
before
{
project
}
before
{
admin
}
before
{
admin
}
it
'creates new project without path and return 201'
do
it
'creates new project without path
but with name
and return 201'
do
expect
{
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
name:
'
foo
'
}.
to
change
{
Project
.
count
}.
by
(
1
)
expect
{
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
name:
'
Foo Project
'
}.
to
change
{
Project
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_http_status
(
201
)
project
=
Project
.
first
expect
(
project
.
name
).
to
eq
(
'Foo Project'
)
expect
(
project
.
path
).
to
eq
(
'foo-project'
)
end
it
'creates new project with name and path and returns 201'
do
expect
{
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
path:
'path-project-Foo'
,
name:
'Foo Project'
}.
to
change
{
Project
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
201
)
project
=
Project
.
first
expect
(
project
.
name
).
to
eq
(
'Foo Project'
)
expect
(
project
.
path
).
to
eq
(
'path-project-Foo'
)
end
end
it
'responds with 400 on failure and not project'
do
it
'responds with 400 on failure and not project'
do
...
...
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