aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/subscription_adapter
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2018-06-08 18:21:05 -0400
committerRafael Mendonça França <rafaelmfranca@gmail.com>2018-06-08 18:21:05 -0400
commitc07c708cf692658fc8e004b5e01e42edadaad5a1 (patch)
treeba70457df7efe852e821187ee7333b67eedc39ad /actioncable/test/subscription_adapter
parent6cd5cc375a5c78d08463254460b324a17d078586 (diff)
parent686f6a762fec59dcda30ed24b12bd9ba9e029d64 (diff)
downloadrails-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.rb23
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