aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 5640178f34..935e50e900 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -8,6 +8,7 @@ Bundler.setup
Bundler.require :default, :test
require 'puma'
+require 'em-hiredis'
require 'mocha/mini_test'
require 'rack/mock'
@@ -18,4 +19,29 @@ ActiveSupport.test_order = :sorted
# Require all the stubs and models
Dir[File.dirname(__FILE__) + '/stubs/*.rb'].each {|file| require file }
+require 'celluloid'
+$CELLULOID_DEBUG = false
+$CELLULOID_TEST = false
Celluloid.logger = Logger.new(StringIO.new)
+
+require 'faye/websocket'
+class << Faye::WebSocket
+ remove_method :ensure_reactor_running
+
+ # We don't want Faye to start the EM reactor in tests because it makes testing much harder.
+ # We want to be able to start and stop EM loop in tests to make things simpler.
+ def ensure_reactor_running
+ # no-op
+ end
+end
+
+class ActionCable::TestCase < ActiveSupport::TestCase
+ def run_in_eventmachine
+ EM.run do
+ yield
+
+ EM.run_deferred_callbacks
+ EM.stop
+ end
+ end
+end