2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
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)
|
|
|
|
importer = described_class.new(project, token: 'foo')
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
expect_next_instance_of(Gitlab::GithubImport::Importer::RepositoryImporter) do |instance|
|
|
|
|
expect(instance).to receive(:execute)
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
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
|