gitlab-org--gitlab-foss/spec/services/ci/cancel_user_pipelines_service_spec.rb
Fabio Pitino c9396f31c6
Cancel all running CI jobs when user is blocked
This prevents a MITM attack where attacker could
still access Git repository if any jobs were
running long enough.
2019-09-30 14:22:05 +02:00

23 lines
596 B
Ruby

# 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) }
it 'cancels all running pipelines and related jobs' do
subject
expect(pipeline.reload).to be_canceled
expect(build.reload).to be_canceled
end
end
end
end