diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/workers/namespaces | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/workers/namespaces')
3 files changed, 37 insertions, 34 deletions
diff --git a/spec/workers/namespaces/in_product_marketing_emails_worker_spec.rb b/spec/workers/namespaces/in_product_marketing_emails_worker_spec.rb new file mode 100644 index 00000000000..722ecfc1dec --- /dev/null +++ b/spec/workers/namespaces/in_product_marketing_emails_worker_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Namespaces::InProductMarketingEmailsWorker, '#perform' do + context 'when the experiment is inactive' do + before do + stub_experiment(in_product_marketing_emails: false) + end + + it 'does not execute the in product marketing emails service' do + expect(Namespaces::InProductMarketingEmailsService).not_to receive(:send_for_all_tracks_and_intervals) + + subject.perform + end + end + + context 'when the experiment is active' do + before do + stub_experiment(in_product_marketing_emails: true) + end + + it 'calls the send_for_all_tracks_and_intervals method on the in product marketing emails service' do + expect(Namespaces::InProductMarketingEmailsService).to receive(:send_for_all_tracks_and_intervals) + + subject.perform + end + end +end diff --git a/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb b/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb index f1789fa8fbd..6d69ccb50bd 100644 --- a/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb +++ b/spec/workers/namespaces/onboarding_pipeline_created_worker_spec.rb @@ -3,30 +3,15 @@ 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 + it_behaves_like 'records an onboarding progress action', :pipeline_created do + let(:namespace) { ci_pipeline.project.namespace } - subject.perform(ci_pipeline.project.namespace_id) - - expect(OnboardingProgress.completed?(ci_pipeline.project.namespace, :pipeline_created)).to eq(true) + subject { described_class.new.perform(ci_pipeline.project.namespace_id) } 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 + it_behaves_like 'does not record an onboarding progress action' do + subject { described_class.new.perform(nil) } 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 a773e160fab..14428c0ecb8 100644 --- a/spec/workers/namespaces/onboarding_user_added_worker_spec.rb +++ b/spec/workers/namespaces/onboarding_user_added_worker_spec.rb @@ -3,20 +3,9 @@ require 'spec_helper' RSpec.describe Namespaces::OnboardingUserAddedWorker, '#perform' do - include AfterNextHelpers + let_it_be(:namespace) { create(:group) } - let_it_be(:group) { create(:group) } + subject { described_class.new.perform(namespace.id) } - 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 - - subject.perform(group.id) - - expect(OnboardingProgress.completed?(group, :user_added)).to be(true) - end + it_behaves_like 'records an onboarding progress action', :user_added end |