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
b7ac654b
Commit
b7ac654b
authored
Feb 20, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2988 from Asquera/error_project_limit
API: creating last project before limit returns 404
parents
25e4c512
30258244
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
app/models/project.rb
app/models/project.rb
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+20
-0
No files found.
app/models/project.rb
View file @
b7ac654b
...
@@ -146,7 +146,7 @@ class Project < ActiveRecord::Base
...
@@ -146,7 +146,7 @@ class Project < ActiveRecord::Base
end
end
def
saved?
def
saved?
id
&&
vali
d?
id
&&
persiste
d?
end
end
def
import?
def
import?
...
...
spec/requests/api/projects_spec.rb
View file @
b7ac654b
...
@@ -33,6 +33,20 @@ describe Gitlab::API do
...
@@ -33,6 +33,20 @@ describe Gitlab::API do
end
end
describe
"POST /projects"
do
describe
"POST /projects"
do
context
"maximum number of projects reached"
do
before
do
(
1
..
user2
.
projects_limit
).
each
do
|
project
|
post
api
(
"/projects"
,
user2
),
name:
"foo
#{
project
}
"
end
end
it
"should not create new project"
do
expect
{
post
api
(
"/projects"
,
user2
),
name:
'foo'
}.
to
change
{
Project
.
count
}.
by
(
0
)
end
end
it
"should create new project without path"
do
it
"should create new project without path"
do
expect
{
post
api
(
"/projects"
,
user
),
name:
'foo'
}.
to
change
{
Project
.
count
}.
by
(
1
)
expect
{
post
api
(
"/projects"
,
user
),
name:
'foo'
}.
to
change
{
Project
.
count
}.
by
(
1
)
end
end
...
@@ -41,6 +55,12 @@ describe Gitlab::API do
...
@@ -41,6 +55,12 @@ describe Gitlab::API do
expect
{
post
api
(
"/projects"
,
user
)
}.
to_not
change
{
Project
.
count
}
expect
{
post
api
(
"/projects"
,
user
)
}.
to_not
change
{
Project
.
count
}
end
end
it
"should create last project before reaching project limit"
do
(
1
..
user2
.
projects_limit
-
1
).
each
{
|
p
|
post
api
(
"/projects"
,
user2
),
name:
"foo
#{
p
}
"
}
post
api
(
"/projects"
,
user2
),
name:
"foo"
response
.
status
.
should
==
201
end
it
"should respond with 201 on success"
do
it
"should respond with 201 on success"
do
post
api
(
"/projects"
,
user
),
name:
'foo'
post
api
(
"/projects"
,
user
),
name:
'foo'
response
.
status
.
should
==
201
response
.
status
.
should
==
201
...
...
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