Commit dde8ed44553626ec8db9ad97eed95c2d12dc4dc7
1 parent
8c44789e
Exists in
master
and in
4 other branches
Fix milestone API specs and moved to requests/api
Closes #1331
Showing
3 changed files
with
48 additions
and
47 deletions
Show diff stats
spec/api/milestones_spec.rb
@@ -1,46 +0,0 @@ | @@ -1,46 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe Gitlab::API do | ||
4 | - let(:user) { Factory :user } | ||
5 | - let!(:project) { Factory :project, owner: user } | ||
6 | - let!(:milestone) { Factory :milestone, project: project } | ||
7 | - | ||
8 | - before { project.add_access(user, :read) } | ||
9 | - before { return pending } | ||
10 | - | ||
11 | - describe "GET /projects/:id/milestones" do | ||
12 | - it "should return project milestones" do | ||
13 | - get "#{api_prefix}/projects/#{project.code}/milestones?private_token=#{user.private_token}" | ||
14 | - response.status.should == 200 | ||
15 | - json_response.should be_an Array | ||
16 | - json_response.first['title'].should == milestone.title | ||
17 | - end | ||
18 | - end | ||
19 | - | ||
20 | - describe "GET /projects/:id/milestones/:milestone_id" do | ||
21 | - it "should return a project milestone by id" do | ||
22 | - get "#{api_prefix}/projects/#{project.code}/milestones/#{milestone.id}?private_token=#{user.private_token}" | ||
23 | - response.status.should == 200 | ||
24 | - json_response['title'].should == milestone.title | ||
25 | - end | ||
26 | - end | ||
27 | - | ||
28 | - describe "POST /projects/:id/milestones" do | ||
29 | - it "should create a new project milestone" do | ||
30 | - post "#{api_prefix}/projects/#{project.code}/milestones?private_token=#{user.private_token}", | ||
31 | - title: 'new milestone' | ||
32 | - response.status.should == 201 | ||
33 | - json_response['title'].should == 'new milestone' | ||
34 | - json_response['description'].should be_nil | ||
35 | - end | ||
36 | - end | ||
37 | - | ||
38 | - describe "PUT /projects/:id/milestones/:milestone_id" do | ||
39 | - it "should update a project milestone" do | ||
40 | - put "#{api_prefix}/projects/#{project.code}/milestones/#{milestone.id}?private_token=#{user.private_token}", | ||
41 | - title: 'updated title' | ||
42 | - response.status.should == 200 | ||
43 | - json_response['title'].should == 'updated title' | ||
44 | - end | ||
45 | - end | ||
46 | -end |
spec/requests/api/issues_spec.rb
@@ -65,7 +65,7 @@ describe Gitlab::API do | @@ -65,7 +65,7 @@ describe Gitlab::API do | ||
65 | 65 | ||
66 | describe "DELETE /projects/:id/issues/:issue_id" do | 66 | describe "DELETE /projects/:id/issues/:issue_id" do |
67 | it "should delete a project issue" do | 67 | it "should delete a project issue" do |
68 | - delete api("/projects/#{project.code}/issues/#{issue.id}?private_token=#{user.private_token}") | 68 | + delete api("/projects/#{project.code}/issues/#{issue.id}", user) |
69 | response.status.should == 405 | 69 | response.status.should == 405 |
70 | end | 70 | end |
71 | end | 71 | end |
@@ -0,0 +1,47 @@ | @@ -0,0 +1,47 @@ | ||
1 | +require 'spec_helper' | ||
2 | + | ||
3 | +describe Gitlab::API do | ||
4 | + include ApiHelpers | ||
5 | + | ||
6 | + let(:user) { Factory :user } | ||
7 | + let!(:project) { Factory :project, owner: user } | ||
8 | + let!(:milestone) { Factory :milestone, project: project } | ||
9 | + | ||
10 | + before { project.add_access(user, :read) } | ||
11 | + | ||
12 | + describe "GET /projects/:id/milestones" do | ||
13 | + it "should return project milestones" do | ||
14 | + get api("/projects/#{project.code}/milestones", user) | ||
15 | + response.status.should == 200 | ||
16 | + json_response.should be_an Array | ||
17 | + json_response.first['title'].should == milestone.title | ||
18 | + end | ||
19 | + end | ||
20 | + | ||
21 | + describe "GET /projects/:id/milestones/:milestone_id" do | ||
22 | + it "should return a project milestone by id" do | ||
23 | + get api("/projects/#{project.code}/milestones/#{milestone.id}", user) | ||
24 | + response.status.should == 200 | ||
25 | + json_response['title'].should == milestone.title | ||
26 | + end | ||
27 | + end | ||
28 | + | ||
29 | + describe "POST /projects/:id/milestones" do | ||
30 | + it "should create a new project milestone" do | ||
31 | + post api("/projects/#{project.code}/milestones", user), | ||
32 | + title: 'new milestone' | ||
33 | + response.status.should == 201 | ||
34 | + json_response['title'].should == 'new milestone' | ||
35 | + json_response['description'].should be_nil | ||
36 | + end | ||
37 | + end | ||
38 | + | ||
39 | + describe "PUT /projects/:id/milestones/:milestone_id" do | ||
40 | + it "should update a project milestone" do | ||
41 | + put api("/projects/#{project.code}/milestones/#{milestone.id}", user), | ||
42 | + title: 'updated title' | ||
43 | + response.status.should == 200 | ||
44 | + json_response['title'].should == 'updated title' | ||
45 | + end | ||
46 | + end | ||
47 | +end |