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

onboarding_pipeline_created_worker_spec.rb « namespaces « workers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f1789fa8fbdf297091b287db8dd3ae4f76e67145 (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 Namespaces::OnboardingPipelineCreatedWorker, '#perform' do
  include AfterNextHelpers

  let_it_be(:ci_pipeline) { create(:ci_pipeline) }

  before do
    OnboardingProgress.onboard(ci_pipeline.project.namespace)
  end

  it 'registers an onboarding progress action' do
    expect_next(OnboardingProgressService, ci_pipeline.project.namespace)
      .to receive(:execute).with(action: :pipeline_created).and_call_original

    subject.perform(ci_pipeline.project.namespace_id)

    expect(OnboardingProgress.completed?(ci_pipeline.project.namespace, :pipeline_created)).to eq(true)
  end

  context "when a namespace doesn't exist" do
    it 'does not register an onboarding progress action' do
      expect_next(OnboardingProgressService, ci_pipeline.project.namespace).not_to receive(:execute)

      subject.perform(nil)

      expect(OnboardingProgress.completed?(ci_pipeline.project.namespace, :pipeline_created)).to eq(false)
    end
  end
end