1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actioncable/test/server/base_test.rb

39 lines
817 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2016-10-02 09:02:01 -04:00
require "test_helper"
require "stubs/test_server"
require "active_support/core_ext/hash/indifferent_access"
class BaseTest < ActionCable::TestCase
2016-10-02 09:02:01 -04:00
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)
2018-04-22 12:33:40 -04:00
assert_called(conn, :close) do
@server.restart
end
2016-10-02 09:02:01 -04:00
end
test "#restart shuts down worker pool" do
2018-04-22 12:33:40 -04:00
assert_called(@server.worker_pool, :halt) do
@server.restart
end
2016-10-02 09:02:01 -04:00
end
test "#restart shuts down pub/sub adapter" do
2018-04-22 12:33:40 -04:00
assert_called(@server.pubsub, :shutdown) do
@server.restart
end
2016-10-02 09:02:01 -04:00
end
end