Welcome to mirror list, hosted at ThFree Co, Russian Federation.

npm_sync_metadata_cache_worker_shared_examples.rb « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: de2dc4c37258f9a46bc06655224163c37e89ad1f (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
30
# frozen_string_literal: true

RSpec.shared_examples 'does not enqueue a worker to sync a metadata cache' do
  it 'does not enqueue a worker to sync a metadata cache' do
    expect(Packages::Npm::CreateMetadataCacheWorker).not_to receive(:perform_async)

    subject
  end
end

RSpec.shared_examples 'enqueue a worker to sync a metadata cache' do
  before do
    project.add_maintainer(user)
  end

  it 'enqueues a worker to create a metadata cache' do
    expect(Packages::Npm::CreateMetadataCacheWorker)
      .to receive(:perform_async).with(project.id, package_name)

    subject
  end

  context 'with npm_metadata_cache disabled' do
    before do
      stub_feature_flags(npm_metadata_cache: false)
    end

    it_behaves_like 'does not enqueue a worker to sync a metadata cache'
  end
end