Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cancel_user_pipelines_service_spec.rb « ci « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b18bf48a50af3501dcae09a4f09ae83f6503e2b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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', :sidekiq_might_not_need_inline do
        subject

        expect(pipeline.reload).to be_canceled
        expect(build.reload).to be_canceled
      end
    end
  end
end