aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/test_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actioncable/test/test_helper.rb')
-rw-r--r--actioncable/test/test_helper.rb24
1 files changed, 8 insertions, 16 deletions
diff --git a/actioncable/test/test_helper.rb b/actioncable/test/test_helper.rb
index 65b45e0c89..8ddbd4e764 100644
--- a/actioncable/test/test_helper.rb
+++ b/actioncable/test/test_helper.rb
@@ -13,24 +13,16 @@ require 'rack/mock'
# Require all the stubs and models
Dir[File.dirname(__FILE__) + '/stubs/*.rb'].each {|file| require file }
-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
+class ActionCable::TestCase < ActiveSupport::TestCase
+ def wait_for_async
+ e = Concurrent.global_io_executor
+ until e.completed_task_count == e.scheduled_task_count
+ sleep 0.1
+ end
end
-end
-class ActionCable::TestCase < ActiveSupport::TestCase
def run_in_eventmachine
- EM.run do
- yield
-
- EM.run_deferred_callbacks
- EM.stop
- end
+ yield
+ wait_for_async
end
end