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

sequential_importer_spec.rb « github_import « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3c3f8ff59d00710192f94fe36607edffa01fa243 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::GithubImport::SequentialImporter do
  describe '#execute' do
    it 'imports a project in sequence' do
      repository = double(:repository)
      project = double(:project, id: 1, repository: repository, import_url: 'http://t0ken@github.another-domain.com/repo-org/repo.git', group: nil)
      importer = described_class.new(project, token: 'foo')

      expect_next_instance_of(Gitlab::GithubImport::Importer::RepositoryImporter) do |instance|
        expect(instance).to receive(:execute)
      end

      described_class::SEQUENTIAL_IMPORTERS.each do |klass|
        instance = double(:instance)

        expect(klass).to receive(:new)
          .with(project, importer.client)
          .and_return(instance)

        expect(instance).to receive(:execute)
      end

      described_class::PARALLEL_IMPORTERS.each do |klass|
        instance = double(:instance)

        expect(klass).to receive(:new)
          .with(project, importer.client, parallel: false)
          .and_return(instance)

        expect(instance).to receive(:execute)
      end

      expect(importer.execute).to eq(true)
    end
  end
end