diff options
author | João Cunha <j.a.cunha@gmail.com> | 2019-03-01 11:44:11 +0000 |
---|---|---|
committer | João Cunha <j.a.cunha@gmail.com> | 2019-03-28 15:50:47 +0000 |
commit | 4e5a9838fa97c9637ac36d5fd339dc311a8443b1 (patch) | |
tree | 647b13172987e91fb2039feece84540dc7c7cc90 /spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb | |
parent | 04496085c1b83ccf5d9bfa546daf2a92e9c644e7 (diff) | |
download | gitlab-ce-4e5a9838fa97c9637ac36d5fd339dc311a8443b1.tar.gz |
Refactor subbed_worker callsrefactor/ce_stubbed_worker
- Creates a support/helper file and moves all the duplication defs
into it
Diffstat (limited to 'spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb')
-rw-r--r-- | spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb b/spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb index e02bcd2f4da..e38044ccceb 100644 --- a/spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb +++ b/spec/migrations/migrate_pipeline_sidekiq_queues_spec.rb @@ -3,12 +3,13 @@ require Rails.root.join('db', 'post_migrate', '20170822101017_migrate_pipeline_s describe MigratePipelineSidekiqQueues, :sidekiq, :redis do include Gitlab::Database::MigrationHelpers + include StubWorker context 'when there are jobs in the queues' do it 'correctly migrates queue when migrating up' do Sidekiq::Testing.disable! do - stubbed_worker(queue: :pipeline).perform_async('Something', [1]) - stubbed_worker(queue: :build).perform_async('Something', [1]) + stub_worker(queue: :pipeline).perform_async('Something', [1]) + stub_worker(queue: :build).perform_async('Something', [1]) described_class.new.up @@ -20,10 +21,10 @@ describe MigratePipelineSidekiqQueues, :sidekiq, :redis do it 'correctly migrates queue when migrating down' do Sidekiq::Testing.disable! do - stubbed_worker(queue: :pipeline_default).perform_async('Class', [1]) - stubbed_worker(queue: :pipeline_processing).perform_async('Class', [2]) - stubbed_worker(queue: :pipeline_hooks).perform_async('Class', [3]) - stubbed_worker(queue: :pipeline_cache).perform_async('Class', [4]) + stub_worker(queue: :pipeline_default).perform_async('Class', [1]) + stub_worker(queue: :pipeline_processing).perform_async('Class', [2]) + stub_worker(queue: :pipeline_hooks).perform_async('Class', [3]) + stub_worker(queue: :pipeline_cache).perform_async('Class', [4]) described_class.new.down @@ -45,11 +46,4 @@ describe MigratePipelineSidekiqQueues, :sidekiq, :redis do expect { described_class.new.down }.not_to raise_error end end - - def stubbed_worker(queue:) - Class.new do - include Sidekiq::Worker - sidekiq_options queue: queue - end - end end |