summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-14 15:51:56 +0100
committerSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-14 15:51:56 +0100
commit6df02adc7a5cb7badf748be783f9a552cf19aeee (patch)
tree67faa977dee10a764e95c2b0e82696ed804e7e7a /spec/requests
parent6fc3263e15b71830e6f1b2a66891da5f4c055137 (diff)
downloadgitlab-ce-6df02adc7a5cb7badf748be783f9a552cf19aeee.tar.gz
API: status code 403 returned if new project would exceed limit
When the project limit is reached the user is not allowed to create new ones. Instead of error code 404 the status code 403 (Forbidden) is returned with error message via API.
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/projects_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index de1b1b09e5f..b635307884b 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -41,6 +41,11 @@ describe Gitlab::API do
expect { post api("/projects", user) }.to_not change {Project.count}
end
+ it "should return a 400 error if name not given" do
+ post api("/projects", user)
+ response.status.should == 400
+ end
+
it "should respond with 201 on success" do
post api("/projects", user), name: 'foo'
response.status.should == 201
@@ -51,6 +56,14 @@ describe Gitlab::API do
response.status.should == 400
end
+ it "should return a 403 error if project limit reached" do
+ (1..user.projects_limit).each do |p|
+ post api("/projects", user), name: "foo#{p}"
+ end
+ post api("/projects", user), name: 'bar'
+ response.status.should == 403
+ end
+
it "should assign attributes to project" do
project = attributes_for(:project, {
description: Faker::Lorem.sentence,