summaryrefslogtreecommitdiff
path: root/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb')
-rw-r--r--spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb b/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb
new file mode 100644
index 00000000000..f1789fa8fbd
--- /dev/null
+++ b/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb
@@ -0,0 +1,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