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

pipeline_update_worker_spec.rb « workers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c5c1cc0eefd72bc1ca4fa9641a51f7d5d27ad1a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe PipelineUpdateWorker do
  describe '#perform' do
    context 'when pipeline exists' do
      let(:pipeline) { create(:ci_pipeline) }

      it 'updates pipeline status' do
        expect_any_instance_of(Ci::Pipeline).to receive(:set_status).with('skipped')

        described_class.new.perform(pipeline.id)
      end

      include_examples 'an idempotent worker' do
        let(:job_args) { [pipeline.id] }

        it 'sets pipeline status to skipped' do
          expect { subject }.to change { pipeline.reload.status }.from('pending').to('skipped')
        end
      end
    end

    context 'when pipeline does not exist' do
      it 'does not raise exception' do
        expect { described_class.new.perform(123) }
          .not_to raise_error
      end
    end
  end
end