Without this, it's very easy to send messages over a subscription even before the
redis pubsub has been fully initialized.
Now we delay calling the subscription#connected method on the client side until we
receive a subscription confirmation message from the server.
* Move specific requires close to where they're needed.
* Use the private active_support/rails dep to wrap up common needs
like eager autoload and module delegation.
* Use a single Rails engine rather than an engine and a railtie.
* Prefer `AS::JSON.encode` to `Object#to_json`.
The run_in_eventmachine test helper method is setting a 0.1 second timer to stop the event machine loop. This causes each test that requires an event machine loop to wait for 0.1 second regardless of how long the test takes to process.
This changes that to call EM.run_deferred_callbacks, which immediatly process pending actions in the event loop and then is able to exit the event loop without doing any waiting.
Before this change, running tests produced
Finished in 2.957857s, 15.8899 runs/s, 27.7228 assertions/s.
After, the tests get
Finished in 0.065942s, 712.7514 runs/s, 1243.5237 assertions/s.