Commit f84db3cc authored by Shinya Maeda's avatar Shinya Maeda

Revert "Avoid conflicts between enumlator's schedule! method and state machine's schedule! method"

This reverts commit 10b09db4.
parent 10b09db4
......@@ -63,7 +63,7 @@ module Ci
push: 1,
web: 2,
trigger: 3,
source_schedule: 4,
schedule: 4,
api: 5,
external: 6
}
......
......@@ -12,7 +12,7 @@ class PipelineScheduleWorker
pipeline = Ci::CreatePipelineService.new(schedule.project,
schedule.owner,
ref: schedule.ref)
.execute(:source_schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule)
.execute(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule)
schedule.deactivate! unless pipeline.persisted?
rescue => e
......
......@@ -21,6 +21,6 @@ class RunPipelineScheduleWorker
Ci::CreatePipelineService.new(schedule.project,
user,
ref: schedule.ref)
.execute(:source_schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule)
.execute(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule)
end
end
......@@ -25,7 +25,7 @@ describe PipelineScheduleWorker do
shared_examples 'successful scheduling' do
it 'creates a new pipeline' do
expect { subject }.to change { project.pipelines.count }.by(1)
expect(Ci::Pipeline.last).to be_source_schedule
expect(Ci::Pipeline.last).to be_schedule
pipeline_schedule.reload
expect(pipeline_schedule.next_run_at).to be > Time.now
......
......@@ -30,7 +30,7 @@ describe RunPipelineScheduleWorker do
it 'calls the Service' do
expect(Ci::CreatePipelineService).to receive(:new).with(project, user, ref: pipeline_schedule.ref).and_return(create_pipeline_service)
expect(create_pipeline_service).to receive(:execute).with(:source_schedule, ignore_skip_ci: true, save_on_errors: false, schedule: pipeline_schedule)
expect(create_pipeline_service).to receive(:execute).with(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: pipeline_schedule)
worker.perform(pipeline_schedule.id, user.id)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment