diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2016-04-06 13:03:07 +0200 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2016-04-06 20:39:43 +0200 |
commit | 0728588c3424fd7e75ca3c45ad1ea84063437311 (patch) | |
tree | e7286603c62774fc6d4932b287c6baaab2e685ea /spec | |
parent | 77e178b5e13633090307afa915eea50927fdabda (diff) | |
download | gitlab-ce-0728588c3424fd7e75ca3c45ad1ea84063437311.tar.gz |
API: Ability to filter milestones by state
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/milestones_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb index db0f6e3c0f5..281d2b25bf5 100644 --- a/spec/requests/api/milestones_spec.rb +++ b/spec/requests/api/milestones_spec.rb @@ -4,6 +4,7 @@ describe API::API, api: true do include ApiHelpers let(:user) { create(:user) } let!(:project) { create(:project, namespace: user.namespace ) } + let!(:closed_milestone) { create(:closed_milestone, project: project, state: :closed) } let!(:milestone) { create(:milestone, project: project) } before { project.team << [user, :developer] } @@ -20,6 +21,22 @@ describe API::API, api: true do get api("/projects/#{project.id}/milestones") expect(response.status).to eq(401) end + + it 'should return an array of active milestones' do + get api("/projects/#{project.id}/milestones?state=active", user) + expect(response.status).to eq(200) + expect(json_response).to be_an Array + expect(json_response.length).to eq(1) + expect(json_response.first['id']).to eq(milestone.id) + end + + it 'should return an array of closed milestones' do + get api("/projects/#{project.id}/milestones?state=closed", user) + expect(response.status).to eq(200) + expect(json_response).to be_an Array + expect(json_response.length).to eq(1) + expect(json_response.first['id']).to eq(closed_milestone.id) + end end describe 'GET /projects/:id/milestones/:milestone_id' do |