diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/services/onboarding_progress_service_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/services/onboarding_progress_service_spec.rb')
-rw-r--r-- | spec/services/onboarding_progress_service_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/services/onboarding_progress_service_spec.rb b/spec/services/onboarding_progress_service_spec.rb new file mode 100644 index 00000000000..59b6083d38a --- /dev/null +++ b/spec/services/onboarding_progress_service_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe OnboardingProgressService do + describe '#execute' do + let(:namespace) { create(:namespace, parent: root_namespace) } + + subject(:execute_service) { described_class.new(namespace).execute(action: :subscription_created) } + + context 'when the namespace is a root' do + let(:root_namespace) { nil } + + it 'records a namespace onboarding progress action for the given namespace' do + expect(NamespaceOnboardingAction).to receive(:create_action) + .with(namespace, :subscription_created).and_call_original + + expect { execute_service }.to change(NamespaceOnboardingAction, :count).by(1) + end + end + + context 'when the namespace is not the root' do + let_it_be(:root_namespace) { build(:namespace) } + + it 'records a namespace onboarding progress action for the root namespace' do + expect(NamespaceOnboardingAction).to receive(:create_action) + .with(root_namespace, :subscription_created).and_call_original + + expect { execute_service }.to change(NamespaceOnboardingAction, :count).by(1) + end + end + end +end |