Skip to content
Snippets Groups Projects
Commit b7ac654b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge pull request #2988 from Asquera/error_project_limit

API: creating last project before limit returns 404
parents 25e4c512 30258244
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -146,7 +146,7 @@ class Project < ActiveRecord::Base
end
 
def saved?
id && valid?
id && persisted?
end
 
def import?
Loading
Loading
Loading
Loading
@@ -33,6 +33,20 @@ describe Gitlab::API do
end
 
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
expect { post api("/projects", user), name: 'foo' }.to change {Project.count}.by(1)
end
Loading
Loading
@@ -41,6 +55,12 @@ describe Gitlab::API do
expect { post api("/projects", user) }.to_not change {Project.count}
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
post api("/projects", user), name: 'foo'
response.status.should == 201
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment