summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-05-03 14:34:23 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-05-03 14:34:23 +0300
commit747232eeda7c79ea65a5c208399a6c72872ff4bc (patch)
treed6677286d072a0651547d18a8fe317686ed907ee /spec/requests
parenta7ddff87481138e43609bd12acbb76da2ec8dd7a (diff)
parent2c544d43c832e816614a9bef35e1899f34b4a53d (diff)
downloadgitlab-ce-747232eeda7c79ea65a5c208399a6c72872ff4bc.tar.gz
Merge branch 'api-iid' of https://github.com/jubianchi/gitlabhq into jubianchi-api-iid
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/issues_spec.rb8
-rw-r--r--spec/requests/api/merge_requests_spec.rb8
-rw-r--r--spec/requests/api/milestones_spec.rb7
3 files changed, 23 insertions, 0 deletions
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index b6b0427debf..8770786f49a 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -194,6 +194,14 @@ describe API::API, api: true do
expect(json_response['iid']).to eq(issue.iid)
end
+ it 'should return a project issue by iid' do
+ get api("/projects/#{project.id}/issues?iid=#{issue.iid}", user)
+ response.status.should == 200
+ json_response.first['title'].should == issue.title
+ json_response.first['id'].should == issue.id
+ json_response.first['iid'].should == issue.iid
+ end
+
it "should return 404 if issue id not found" do
get api("/projects/#{project.id}/issues/54321", user)
expect(response.status).to eq(404)
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 5fca831f9be..dcd50f73326 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -115,6 +115,14 @@ describe API::API, api: true do
expect(json_response['iid']).to eq(merge_request.iid)
end
+ it 'should return merge_request by iid' do
+ url = "/projects/#{project.id}/merge_requests?iid=#{merge_request.iid}"
+ get api(url, user)
+ response.status.should == 200
+ json_response.first['title'].should == merge_request.title
+ json_response.first['id'].should == merge_request.id
+ end
+
it "should return a 404 error if merge_request_id not found" do
get api("/projects/#{project.id}/merge_request/999", user)
expect(response.status).to eq(404)
diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb
index effb0723476..6890dd1f3a7 100644
--- a/spec/requests/api/milestones_spec.rb
+++ b/spec/requests/api/milestones_spec.rb
@@ -30,6 +30,13 @@ describe API::API, api: true do
expect(json_response['iid']).to eq(milestone.iid)
end
+ it 'should return a project milestone by iid' do
+ get api("/projects/#{project.id}/milestones?iid=#{milestone.iid}", user)
+ response.status.should == 200
+ json_response.first['title'].should == milestone.title
+ json_response.first['id'].should == milestone.id
+ end
+
it 'should return 401 error if user not authenticated' do
get api("/projects/#{project.id}/milestones/#{milestone.id}")
expect(response.status).to eq(401)