debian-mirror-gitlab/spec/lib/gitlab/github_import/parallel_importer_spec.rb

36 lines
893 B
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::GithubImport::ParallelImporter do
2018-03-17 18:26:18 +05:30
describe '.async?' do
it 'returns true' do
expect(described_class).to be_async
end
end
describe '#execute', :clean_gitlab_redis_shared_state do
let(:project) { create(:project) }
let(:importer) { described_class.new(project) }
before do
2018-10-15 14:42:47 +05:30
create(:import_state, :started, project: project)
2018-03-17 18:26:18 +05:30
expect(Gitlab::GithubImport::Stage::ImportRepositoryWorker)
.to receive(:perform_async)
.with(project.id)
.and_return('123')
end
it 'schedules the importing of the repository' do
expect(importer.execute).to eq(true)
end
it 'sets the JID in Redis' do
2020-04-22 19:07:51 +05:30
expect(Gitlab::Import::SetAsyncJid).to receive(:set_jid).with(project.import_state).and_call_original
2018-03-17 18:26:18 +05:30
importer.execute
end
end
end