diff options
author | Jon Moss <me@jonathanmoss.me> | 2016-10-02 09:02:01 -0400 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2016-10-02 09:02:01 -0400 |
commit | d1cc11a360ce9b6ede838c5de5523fc421472487 (patch) | |
tree | 371fdb1057341fe3776b753c23eb92788144fed2 /actioncable/test/server | |
parent | 35a497dc2960cf6b46b7c47853f095326123490c (diff) | |
download | rails-d1cc11a360ce9b6ede838c5de5523fc421472487.tar.gz rails-d1cc11a360ce9b6ede838c5de5523fc421472487.tar.bz2 rails-d1cc11a360ce9b6ede838c5de5523fc421472487.zip |
Add tests for Server::Base#restart
Diffstat (limited to 'actioncable/test/server')
-rw-r--r-- | actioncable/test/server/base_test.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/actioncable/test/server/base_test.rb b/actioncable/test/server/base_test.rb new file mode 100644 index 0000000000..f0a51c5a7d --- /dev/null +++ b/actioncable/test/server/base_test.rb @@ -0,0 +1,33 @@ +require "test_helper" +require "stubs/test_server" +require "active_support/core_ext/hash/indifferent_access" + +class BaseTest < ActiveSupport::TestCase + def setup + @server = ActionCable::Server::Base.new + @server.config.cable = { adapter: "async" }.with_indifferent_access + end + + class FakeConnection + def close + end + end + + test "#restart closes all open connections" do + conn = FakeConnection.new + @server.add_connection(conn) + + conn.expects(:close) + @server.restart + end + + test "#restart shuts down worker pool" do + @server.worker_pool.expects(:halt) + @server.restart + end + + test "#restart shuts down pub/sub adapter" do + @server.pubsub.expects(:shutdown) + @server.restart + end +end |