diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-06-08 18:21:05 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-06-08 18:21:05 -0400 |
commit | c07c708cf692658fc8e004b5e01e42edadaad5a1 (patch) | |
tree | ba70457df7efe852e821187ee7333b67eedc39ad /actioncable/test/subscription_adapter | |
parent | 6cd5cc375a5c78d08463254460b324a17d078586 (diff) | |
parent | 686f6a762fec59dcda30ed24b12bd9ba9e029d64 (diff) | |
download | rails-c07c708cf692658fc8e004b5e01e42edadaad5a1.tar.gz rails-c07c708cf692658fc8e004b5e01e42edadaad5a1.tar.bz2 rails-c07c708cf692658fc8e004b5e01e42edadaad5a1.zip |
Merge pull request #27577 from maclover7/jm-fix-27547
Action Cable owns database connection, not Active Record
Diffstat (limited to 'actioncable/test/subscription_adapter')
-rw-r--r-- | actioncable/test/subscription_adapter/postgresql_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/actioncable/test/subscription_adapter/postgresql_test.rb b/actioncable/test/subscription_adapter/postgresql_test.rb index 1c375188ba..5fb26a8896 100644 --- a/actioncable/test/subscription_adapter/postgresql_test.rb +++ b/actioncable/test/subscription_adapter/postgresql_test.rb @@ -39,4 +39,27 @@ class PostgresqlAdapterTest < ActionCable::TestCase def cable_config { adapter: "postgresql" } end + + def test_clear_active_record_connections_adapter_still_works + server = ActionCable::Server::Base.new + server.config.cable = cable_config.with_indifferent_access + server.config.logger = Logger.new(StringIO.new).tap { |l| l.level = Logger::UNKNOWN } + + adapter_klass = Class.new(server.config.pubsub_adapter) do + def active? + !@listener.nil? + end + end + + adapter = adapter_klass.new(server) + + subscribe_as_queue("channel", adapter) do |queue| + adapter.broadcast("channel", "hello world") + assert_equal "hello world", queue.pop + end + + ActiveRecord::Base.clear_reloadable_connections! + + assert adapter.active? + end end |