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
bogdanvlviv 74a9a29277
Include ActiveSupport::Testing::MethodCallAssertions to ActionCable::TestCase
Remove all `include ActiveSupport::Testing::MethodCallAssertions`
in actioncable's tests since we can do it only in `ActionCable::TestCase`
in order to prevent code duplication.
We use the same approach for other modules of Rails.
2018-06-08 23:29:05 +03:00

38 lines
817 B
Ruby

# frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
require "active_support/core_ext/hash/indifferent_access"
class BaseTest < ActionCable::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)
assert_called(conn, :close) do
@server.restart
end
end
test "#restart shuts down worker pool" do
assert_called(@server.worker_pool, :halt) do
@server.restart
end
end
test "#restart shuts down pub/sub adapter" do
assert_called(@server.pubsub, :shutdown) do
@server.restart
end
end
end