diff options
Diffstat (limited to 'spec/lib/gitlab/github_import/parallel_scheduling_spec.rb')
-rw-r--r-- | spec/lib/gitlab/github_import/parallel_scheduling_spec.rb | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb b/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb index 860bb60f3ed..cefad3baa31 100644 --- a/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb +++ b/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb @@ -295,11 +295,12 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling do end it 'imports data in parallel batches with delays' do - expect(worker_class).to receive(:bulk_perform_in).with(1.second, [ - [project.id, { title: 'Foo' }, an_instance_of(String)], - [project.id, { title: 'Foo' }, an_instance_of(String)], - [project.id, { title: 'Foo' }, an_instance_of(String)] - ], batch_size: batch_size, batch_delay: batch_delay) + expect(worker_class).to receive(:bulk_perform_in) + .with(1.second, [ + [project.id, { title: 'Foo' }, an_instance_of(String)], + [project.id, { title: 'Foo' }, an_instance_of(String)], + [project.id, { title: 'Foo' }, an_instance_of(String)] + ], batch_size: batch_size, batch_delay: batch_delay) importer.parallel_import end @@ -308,7 +309,8 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling do describe '#each_object_to_import' do let(:importer) { importer_class.new(project, client) } - let(:object) { double(:object) } + let(:object) { {} } + let(:object_counter_class) { Gitlab::GithubImport::ObjectCounter } before do expect(importer) @@ -334,6 +336,9 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling do .with(object) .and_return(false) + expect(object_counter_class) + .to receive(:increment) + expect(importer) .to receive(:mark_as_imported) .with(object) @@ -364,6 +369,9 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling do .with(object) .and_return(false) + expect(object_counter_class) + .to receive(:increment) + expect(importer) .to receive(:mark_as_imported) .with(object) @@ -407,6 +415,9 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling do .with(object) .and_return(true) + expect(object_counter_class) + .not_to receive(:increment) + expect(importer) .not_to receive(:mark_as_imported) @@ -463,4 +474,13 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling do importer.mark_as_imported(object) end end + + describe '#increment_object_counter?' do + let(:github_issue) { {} } + let(:importer) { importer_class.new(project, client) } + + it 'returns true' do + expect(importer).to be_increment_object_counter(github_issue) + end + end end |