diff options
Diffstat (limited to 'spec/workers/gitlab/github_import/stage')
-rw-r--r-- | spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb | 27 | ||||
-rw-r--r-- | spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb | 9 |
2 files changed, 19 insertions, 17 deletions
diff --git a/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb b/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb index 8dea24dc74f..132fe1dc618 100644 --- a/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb @@ -26,21 +26,18 @@ RSpec.describe Gitlab::GithubImport::Stage::FinishImportWorker do .to receive(:increment) .and_call_original - expect_next_instance_of(Gitlab::Import::Logger) do |logger| - expect(logger) - .to receive(:info) - .with( - message: 'GitHub project import finished', - import_stage: 'Gitlab::GithubImport::Stage::FinishImportWorker', - import_source: :github, - object_counts: { - 'fetched' => {}, - 'imported' => {} - }, - project_id: project.id, - duration_s: a_kind_of(Numeric) - ) - end + expect(Gitlab::GithubImport::Logger) + .to receive(:info) + .with( + message: 'GitHub project import finished', + import_stage: 'Gitlab::GithubImport::Stage::FinishImportWorker', + object_counts: { + 'fetched' => {}, + 'imported' => {} + }, + project_id: project.id, + duration_s: a_kind_of(Numeric) + ) worker.report_import_time(project) end diff --git a/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb index bc51a44e057..875fc082975 100644 --- a/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe Gitlab::GithubImport::Stage::ImportRepositoryWorker do let(:project) { double(:project, id: 4) } + let(:worker) { described_class.new } describe '#import' do @@ -36,15 +37,19 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportRepositoryWorker do context 'when the import fails' do it 'does not schedule the importing of the base data' do client = double(:client) + exception_class = Gitlab::Git::Repository::NoRepository expect_next_instance_of(Gitlab::GithubImport::Importer::RepositoryImporter) do |instance| - expect(instance).to receive(:execute).and_return(false) + expect(instance).to receive(:execute).and_raise(exception_class) end expect(Gitlab::GithubImport::Stage::ImportBaseDataWorker) .not_to receive(:perform_async) - worker.import(client, project) + expect(worker.abort_on_failure).to eq(true) + + expect { worker.import(client, project) } + .to raise_error(exception_class) end end end |