2019-09-13 02:40:00 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Ci::CancelUserPipelinesService do
|
|
|
|
describe '#execute' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
subject { described_class.new.execute(user) }
|
|
|
|
|
|
|
|
context 'when user has running CI pipelines' do
|
|
|
|
let(:pipeline) { create(:ci_pipeline, :running, user: user) }
|
|
|
|
let!(:build) { create(:ci_build, :running, pipeline: pipeline) }
|
|
|
|
|
2019-10-23 05:06:03 -04:00
|
|
|
it 'cancels all running pipelines and related jobs', :sidekiq_might_not_need_inline do
|
2019-09-13 02:40:00 -04:00
|
|
|
subject
|
|
|
|
|
|
|
|
expect(pipeline.reload).to be_canceled
|
|
|
|
expect(build.reload).to be_canceled
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|