Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options to runner_jobs #492

Merged
merged 2 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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