summaryrefslogtreecommitdiff
path: root/spec/requests/api/milestones_spec.rb
diff options
context:
space:
mode:
authorSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-06 15:05:56 +0100
committerSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-06 17:11:00 +0100
commitb9d40d2524a78013737be16b4cd0976ded843a1b (patch)
treec5af89e558dc3e3fc9374218b4191e244b7971f3 /spec/requests/api/milestones_spec.rb
parent5be0265fe7e82a127e9fd2805e81e4e40f5e3c5f (diff)
downloadgitlab-ce-b9d40d2524a78013737be16b4cd0976ded843a1b.tar.gz
Tests added to check status codes when handling milestone via API
A few more tests added to check status code when creating or updating milestones.
Diffstat (limited to 'spec/requests/api/milestones_spec.rb')
-rw-r--r--spec/requests/api/milestones_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb
index 80696671462..3cab63557a9 100644
--- a/spec/requests/api/milestones_spec.rb
+++ b/spec/requests/api/milestones_spec.rb
@@ -24,6 +24,11 @@ describe Gitlab::API do
response.status.should == 200
json_response['title'].should == milestone.title
end
+
+ it "should return a 404 error if milestone id not found" do
+ get api("/projects/#{project.id}/milestones/1234", user)
+ response.status.should == 404
+ end
end
describe "POST /projects/:id/milestones" do
@@ -34,6 +39,19 @@ describe Gitlab::API do
json_response['title'].should == 'new milestone'
json_response['description'].should be_nil
end
+
+ it "should create a new project milestone with description and due date" do
+ post api("/projects/#{project.id}/milestones", user),
+ title: 'new milestone', description: 'release', due_date: '2013-03-02'
+ response.status.should == 201
+ json_response['description'].should == 'release'
+ json_response['due_date'].should == '2013-03-02'
+ end
+
+ it "should return a 400 error if title is missing" do
+ post api("/projects/#{project.id}/milestones", user)
+ response.status.should == 400
+ end
end
describe "PUT /projects/:id/milestones/:milestone_id" do
@@ -43,5 +61,11 @@ describe Gitlab::API do
response.status.should == 200
json_response['title'].should == 'updated title'
end
+
+ it "should return a 404 error if milestone is not found" do
+ put api("/projects/#{project.id}/milestones/1234", user),
+ title: 'updated title'
+ response.status.should == 404
+ end
end
end