summaryrefslogtreecommitdiff
path: root/spec/workers/namespaces/onboarding_issue_created_worker_spec.rb
blob: 0a896d864b73ca988be50a6704062181bd8510c6 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Namespaces::OnboardingIssueCreatedWorker, '#perform' do
  let_it_be(:issue) { create(:issue) }

  let(:namespace) { issue.project.namespace }

  it_behaves_like 'records an onboarding progress action', :issue_created do
    subject { described_class.new.perform(namespace.id) }
  end

  it_behaves_like 'does not record an onboarding progress action' do
    subject { described_class.new.perform(nil) }
  end

  it_behaves_like 'an idempotent worker' do
    let(:job_args) { [namespace.id] }

    it 'sets the onboarding progress action' do
      Onboarding::Progress.onboard(namespace)

      subject

      expect(Onboarding::Progress.completed?(namespace, :issue_created)).to eq(true)
    end
  end
end