diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2017-11-21 12:37:07 +0100 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2017-11-28 00:36:48 +0100 |
commit | b7ed102ea601fb4c6f65c5a982058f8c92883d31 (patch) | |
tree | 2992a0e51f697e00008a7832e3dc1bb8e6ae5599 /spec/requests/api/runners_spec.rb | |
parent | 8d3e80692cbeea06dd28a052554f0c262004e18d (diff) | |
download | gitlab-ce-b7ed102ea601fb4c6f65c5a982058f8c92883d31.tar.gz |
Allow filtering by 'status'
Diffstat (limited to 'spec/requests/api/runners_spec.rb')
-rw-r--r-- | spec/requests/api/runners_spec.rb | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb index d68fa13af1e..1ffbb06803f 100644 --- a/spec/requests/api/runners_spec.rb +++ b/spec/requests/api/runners_spec.rb @@ -370,8 +370,8 @@ describe API::Runners do expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers - expect(json_response.length).to eq(1) - expect(json_response[0]).to include('id' => job_2.id) + expect(json_response).to be_an(Array) + expect(json_response.length).to eq(2) end end @@ -382,8 +382,29 @@ describe API::Runners do expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers + expect(json_response).to be_an(Array) + expect(json_response.length).to eq(2) + end + end + + context 'when valid status is provided' do + it 'return filtered jobs' do + get api("/runners/#{specific_runner.id}/jobs?status=failed", admin) + + expect(response).to have_gitlab_http_status(200) + expect(response).to include_pagination_headers + + expect(json_response).to be_an(Array) expect(json_response.length).to eq(1) - expect(json_response[0]).to include('id' => job_4.id) + expect(json_response.first).to include('id' => job_5.id) + end + end + + context 'when invalid status is provided' do + it 'return 404' do + get api("/runners/#{specific_runner.id}/jobs?status=non-existing", admin) + + expect(response).to have_gitlab_http_status(404) end end end @@ -414,8 +435,29 @@ describe API::Runners do expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers + expect(json_response).to be_an(Array) + expect(json_response.length).to eq(2) + end + end + + context 'when valid status is provided' do + it 'return filtered jobs' do + get api("/runners/#{specific_runner.id}/jobs?status=failed", user) + + expect(response).to have_gitlab_http_status(200) + expect(response).to include_pagination_headers + + expect(json_response).to be_an(Array) expect(json_response.length).to eq(1) - expect(json_response[0]).to include('id' => job_4.id) + expect(json_response.first).to include('id' => job_5.id) + end + end + + context 'when invalid status is provided' do + it 'return 404' do + get api("/runners/#{specific_runner.id}/jobs?status=non-existing", user) + + expect(response).to have_gitlab_http_status(404) end end end |