diff options
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb | 18 | ||||
-rw-r--r-- | spec/workers/namespaces/onboarding_user_added_worker_spec.rb | 10 |
2 files changed, 20 insertions, 8 deletions
diff --git a/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb b/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb index 240a0b69834..f1789fa8fbd 100644 --- a/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb +++ b/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb @@ -7,20 +7,26 @@ RSpec.describe Namespaces::OnboardingPipelineCreatedWorker, '#perform' do let_it_be(:ci_pipeline) { create(:ci_pipeline) } - it 'records the event' do + 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 - expect do - subject.perform(ci_pipeline.project.namespace_id) - end.to change(NamespaceOnboardingAction, :count).by(1) + 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 nothing" do + it 'does not register an onboarding progress action' do expect_next(OnboardingProgressService, ci_pipeline.project.namespace).not_to receive(:execute) - expect { subject.perform(nil) }.not_to change(NamespaceOnboardingAction, :count) + subject.perform(nil) + + expect(OnboardingProgress.completed?(ci_pipeline.project.namespace, :pipeline_created)).to eq(false) end end end diff --git a/spec/workers/namespaces/onboarding_user_added_worker_spec.rb b/spec/workers/namespaces/onboarding_user_added_worker_spec.rb index 03c668259f8..a773e160fab 100644 --- a/spec/workers/namespaces/onboarding_user_added_worker_spec.rb +++ b/spec/workers/namespaces/onboarding_user_added_worker_spec.rb @@ -7,10 +7,16 @@ RSpec.describe Namespaces::OnboardingUserAddedWorker, '#perform' do let_it_be(:group) { create(:group) } - it 'records the event' do + before do + OnboardingProgress.onboard(group) + end + + it 'registers an onboarding progress action' do expect_next(OnboardingProgressService, group) .to receive(:execute).with(action: :user_added).and_call_original - expect { subject.perform(group.id) }.to change(NamespaceOnboardingAction, :count).by(1) + subject.perform(group.id) + + expect(OnboardingProgress.completed?(group, :user_added)).to be(true) end end |