diff options
author | Rémy Coutable <remy@rymai.me> | 2016-11-22 19:16:43 +0300 |
---|---|---|
committer | Alejandro Rodríguez <alejorro70@gmail.com> | 2016-11-24 18:34:34 +0300 |
commit | d97ac2f69dcb5f23dfc6f9475757785b72de1b53 (patch) | |
tree | 8958792beed49b01b29a89d2c0ffea22ad303c4e /spec | |
parent | dcdb42180dfc836c0aed5972da6850266450f4f1 (diff) |
Merge branch 'fix-api-iid-filter' into 'master'
Fix IID filter for merge requests and milestones
I updated the example in the docs and added a test. The milestones API was also broken for the same reason.
Related to !7358 and !7373
See merge request !7648
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 10 | ||||
-rw-r--r-- | spec/requests/api/milestones_spec.rb | 9 |
2 files changed, 19 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 7b3d1460c90..37fcb2bc3a9 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -169,6 +169,16 @@ describe API::API, api: true do expect(json_response.first['id']).to eq merge_request.id end + it 'returns merge_request by iid array' do + get api("/projects/#{project.id}/merge_requests", user), iid: [merge_request.iid, merge_request_closed.iid] + + expect(response).to have_http_status(200) + expect(json_response).to be_an Array + expect(json_response.length).to eq(2) + expect(json_response.first['title']).to eq merge_request_closed.title + expect(json_response.first['id']).to eq merge_request_closed.id + end + it "returns a 404 error if merge_request_id not found" do get api("/projects/#{project.id}/merge_requests/999", user) expect(response).to have_http_status(404) diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb index 62327f64e50..5d7b39e71b8 100644 --- a/spec/requests/api/milestones_spec.rb +++ b/spec/requests/api/milestones_spec.rb @@ -61,6 +61,15 @@ describe API::API, api: true do expect(json_response.first['id']).to eq closed_milestone.id end + it 'returns a project milestone by iid array' do + get api("/projects/#{project.id}/milestones", user), iid: [milestone.iid, closed_milestone.iid] + + expect(response).to have_http_status(200) + expect(json_response.size).to eq(2) + expect(json_response.first['title']).to eq milestone.title + expect(json_response.first['id']).to eq milestone.id + end + it 'returns 401 error if user not authenticated' do get api("/projects/#{project.id}/milestones/#{milestone.id}") |