Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add Delayed::Job #134

Closed
croaky opened this Issue · 2 comments

1 participant

@croaky
Owner

We want to deliver emails in the background of all our Rails apps. Other long-running processes that don't need to block the HTTP request/response cycle can also be done in the background.

# spec/spec_helper.rb
RSpec.configure do |config|
  config.around(:each, type: :feature) do |example|
    run_background_jobs_immediately do
      example.run
    end
  end

  config.include BackgroundJobs
end

# spec/support/background_jobs.rb
module BackgroundJobs
  def run_background_jobs_immediately
    delay_jobs = Delayed::Worker.delay_jobs
    Delayed::Worker.delay_jobs = false
    yield
    Delayed::Worker.delay_jobs = delay_jobs
  end
end
@croaky
Owner

Done in #166.

@croaky croaky closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.