Skip to content

Commit

Permalink
Add options to runner_jobs (NARKOZ#492)
Browse files Browse the repository at this point in the history
* Add options to runner_jobs

* Whitespace cleanup
  • Loading branch information
atiaxi authored and onshi committed Apr 30, 2020
1 parent 232d766 commit 2d74c3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/gitlab/client/runners.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ def delete_runner(id)
# Gitlab.runner_jobs(1)
#
# @param [Integer] id The ID of a runner.
# @param [Hash] options A customizable set of options.
# @option options [String] :status Status of the job; one of: running, success, failed, canceled
# @return [Array<Gitlab::ObjectifiedHash>]
def runner_jobs(runner_id)
get("/runners/#{url_encode runner_id}/jobs")
def runner_jobs(runner_id, options = {})
get("/runners/#{url_encode runner_id}/jobs", query: options)
end

# List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings.
Expand Down
6 changes: 3 additions & 3 deletions spec/gitlab/client/runners_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@

describe '.runner_jobs' do
before do
stub_get('/runners/1/jobs', 'runner_jobs')
@jobs = Gitlab.runner_jobs(1)
stub_get('/runners/1/jobs?status=running', 'runner_jobs')
@jobs = Gitlab.runner_jobs(1, status: :running)
end

it 'gets the correct resource' do
expect(a_get('/runners/1/jobs')).to have_been_made
expect(a_get('/runners/1/jobs').with(query: { status: :running })).to have_been_made
end
end

Expand Down

0 comments on commit 2d74c3e

Please sign in to comment.