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

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

# This shared_example requires the following variables:
#   let(:service_class) { Gitlab::DatabaseImporters::SelfMonitoring::Project::DeleteService }
#   let(:service) { instance_double(service_class) }
RSpec.shared_examples 'executes service' do
  before do
    allow(service_class).to receive(:new) { service }
  end

  it 'runs the service' do
    expect(service).to receive(:execute)

    subject.perform
  end
end

RSpec.shared_examples 'returns in_progress based on Sidekiq::Status' do
  it 'returns true when job is enqueued' do
    jid = described_class.with_status.perform_async

    expect(described_class.in_progress?(jid)).to eq(true)
  end

  it 'returns false when job does not exist' do
    expect(described_class.in_progress?('fake_jid')).to eq(false)
  end
end