Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
12 changes: 12 additions & 0 deletions lib/gitlab/client/pipeline_schedules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ def pipeline_schedule(project, id)
get("/projects/#{url_encode project}/pipeline_schedules/#{id}")
end

# Get all pipelines triggered by a pipeline schedule
#
# @example
# Gitlab.pipelines_by_pipeline_schedule(5, 3)
#
# @param [Integer, String] project The ID or name of a project.
# @param [Integer] id The ID of the pipeline schedule.
# @return [Array<Gitlab::ObjectifiedHash>]
def pipelines_by_pipeline_schedule(project, id)
get("/projects/#{url_encode project}/pipeline_schedules/#{id}/pipelines")
end

# Create a pipeline schedule.
#
# @example
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/pipeline_schedule_get_pipelines.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":15,"iid":2,"project_id":100,"sha":"a91957a858320c0e17f3a0eca7cfacbff50ea29a","ref":"new-pipeline","status":"pending","source":"schedule","created_at":"2016-08-16T10:23:19.007Z","updated_at":"2016-08-16T10:23:19.216Z","web_url":"http://localhost:3000/root"}]
15 changes: 15 additions & 0 deletions spec/gitlab/client/pipeline_schedules_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@
end
end

describe '.pipelines_by_pipeline_schedule' do
before do
stub_get('/projects/3/pipeline_schedules/5/pipelines', 'pipeline_schedule_get_pipelines')
@pipeline_schedule_get_pipelines = Gitlab.pipelines_by_pipeline_schedule(3, 5)
end

it 'gets the correct resource' do
expect(a_get('/projects/3/pipeline_schedules/5/pipelines')).to have_been_made
end

it "returns a response of project's pipeline schedules" do
expect(@pipeline_schedule_get_pipelines).to be_a Gitlab::PaginatedResponse
end
end

describe '.create_pipeline_schedule' do
before do
stub_post('/projects/3/pipeline_schedules', 'pipeline_schedule_create')
Expand Down