aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2017-01-10 01:09:36 +0900
committerAkira Matsuda <ronnie@dio.jp>2017-01-10 19:39:54 +0900
commitbd8ae0c2e235d050a38be0759bd590e9144a6d54 (patch)
treeb8e01bd3e8d8a1ab4f5b0d8a9af6afc1573948f3
parentaa92d4a0faca31f53cbc0bb1fc1b599c8eb7a65d (diff)
downloadrails-bd8ae0c2e235d050a38be0759bd590e9144a6d54.tar.gz
rails-bd8ae0c2e235d050a38be0759bd590e9144a6d54.tar.bz2
rails-bd8ae0c2e235d050a38be0759bd590e9144a6d54.zip
Reconnecting AR::Base's connection breaks sqlite3_mem tests
so let's test with a tiny inner-class model instead
-rw-r--r--activerecord/test/cases/connection_pool_test.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb
index 42600e53fd..81d7113bc6 100644
--- a/activerecord/test/cases/connection_pool_test.rb
+++ b/activerecord/test/cases/connection_pool_test.rb
@@ -341,14 +341,18 @@ module ActiveRecord
end
end
+ class ConnectionTestModel < ActiveRecord::Base
+ end
+
def test_connection_notification_is_called
payloads = []
subscription = ActiveSupport::Notifications.subscribe("!connection.active_record") do |name, started, finished, unique_id, payload|
payloads << payload
end
- ActiveRecord::Base.establish_connection :arunit
+ ConnectionTestModel.establish_connection :arunit
+
assert_equal [:config, :connection_id, :spec_name], payloads[0].keys.sort
- assert_equal "primary", payloads[0][:spec_name]
+ assert_equal "ActiveRecord::ConnectionAdapters::ConnectionPoolTest::ConnectionTestModel", payloads[0][:spec_name]
ensure
ActiveSupport::Notifications.unsubscribe(subscription) if subscription
end