Module: Spree::TestingSupport::JobHelpers

Defined in:
lib/spree/testing_support/job_helpers.rb

Instance Method Summary collapse

Instance Method Details

#perform_enqueued_jobsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/spree/testing_support/job_helpers.rb', line 6

def perform_enqueued_jobs
  adapter = ActiveJob::Base.queue_adapter

  old = adapter.perform_enqueued_jobs
  old_at = adapter.perform_enqueued_at_jobs

  begin
    adapter.perform_enqueued_jobs = true
    adapter.perform_enqueued_at_jobs = true

    yield
  ensure
    adapter.perform_enqueued_jobs = old
    adapter.perform_enqueued_at_jobs = old_at
  end
end