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

tree_restorer_shared_examples.rb « project « import_export « gitlab « lib « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5f9316c1cde6ccfa385c49a6e748d04ad66144d2 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# frozen_string_literal: true

# Shared examples for Project::TreeRestorer (shared to allow the testing
# of EE-specific features)
RSpec.shared_examples 'restores project successfully' do |**results|
  it 'restores the project' do
    expect(shared.errors).to be_empty
    expect(restored_project_json).to be_truthy
  end

  it 'has labels' do
    labels_size = results.fetch(:labels, 0)

    expect(project.labels.size).to eq(labels_size)
  end

  it 'has label priorities' do
    label_with_priorities = results[:label_with_priorities]

    if label_with_priorities
      expect(project.labels.find_by(title: label_with_priorities).priorities).not_to be_empty
    end
  end

  it 'has milestones' do
    expect(project.milestones.size).to eq(results.fetch(:milestones, 0))
  end

  it 'has issues' do
    expect(project.issues.size).to eq(results.fetch(:issues, 0))
  end

  it 'has ci pipelines' do
    expect(project.ci_pipelines.size).to eq(results.fetch(:ci_pipelines, 0))
  end

  it 'has external pull requests' do
    expect(project.external_pull_requests.size).to eq(results.fetch(:external_pull_requests, 0))
  end

  it 'does not set params that are excluded from import_export settings' do
    expect(project.import_type).to be_nil
    expect(project.creator_id).not_to eq non_existing_record_id
  end

  it 'records exact number of import failures' do
    expect(project.import_failures.size).to eq(results.fetch(:import_failures, 0))
  end
end