Working with a Sinatra application, and found 3 ways to run a background process:
Thread.newProcess.forkProcess.spawn
Figured out how to get the first two to work, but now the challenge is that the tests need to run synchronously (for a few reasons).
What is a good way to run jobs asynchronously in production, but force the tests to run synchronously? Preferably with a call in the spec_helper…?
Ruby 1.9.3, Sinatra app, RSpec.
Here’s what I came up with:
I like this solution because it is transparent: it runs the exact same code, just synchronously.
Any suggestions/problems with it? Is it necessary to manage zombies? How?