diff options
author | jubianchi <julien.bianchi@pmsipilot.com> | 2014-08-14 12:41:16 +0200 |
---|---|---|
committer | jubianchi <contact@jubianchi.fr> | 2014-09-01 13:51:40 +0200 |
commit | 4fdd21685cbbac7fc23e17c531cf28eeecc98577 (patch) | |
tree | 72f3da1af61a5dfe5fb52ae17d8c5045e0023bbe /spec | |
parent | 31773f4dd7f89df7cea3ef4b3f547b479329ef9e (diff) | |
download | gitlab-ce-4fdd21685cbbac7fc23e17c531cf28eeecc98577.tar.gz |
Filters issues by state via API
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/issues_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index 08dc94ebdf3..f70b56b194f 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_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_issue) { create(:closed_issue, author: user, assignee: user, project: project, state: :closed) } let!(:issue) { create(:issue, author: user, assignee: user, project: project) } let!(:label) do create(:label, title: 'label', color: '#FFAABB', project: project) @@ -32,6 +33,31 @@ describe API::API, api: true do response.headers['Link'].should == '<http://www.example.com/api/v3/issues?page=1&per_page=3>; rel="first", <http://www.example.com/api/v3/issues?page=1&per_page=3>; rel="last"' end + + it 'should return an array of closed issues' do + get api('/issues?state=closed', user) + response.status.should == 200 + json_response.should be_an Array + json_response.length.should == 1 + json_response.first['id'].should == closed_issue.id + end + + it 'should return an array of opened issues' do + get api('/issues?state=opened', user) + response.status.should == 200 + json_response.should be_an Array + json_response.length.should == 1 + json_response.first['id'].should == issue.id + end + + it 'should return an array of all issues' do + get api('/issues?state=all', user) + response.status.should == 200 + json_response.should be_an Array + json_response.length.should == 2 + json_response.first['id'].should == issue.id + json_response.second['id'].should == closed_issue.id + end end end |