aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/query_cache_test.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-02-21 09:41:36 +1030
committerGitHub <noreply@github.com>2017-02-21 09:41:36 +1030
commit0ce641839aa59d8c8306ec21cfd5f31aaa9b169c (patch)
tree7da92c4b25a0f7afe124b5a0e6c136d8f13d5504 /activerecord/test/cases/query_cache_test.rb
parentab0146075ab063f601030178f3e1da56e886199e (diff)
parentd6466beb9fff9f2ba4f73673e65f087dd6bba488 (diff)
downloadrails-0ce641839aa59d8c8306ec21cfd5f31aaa9b169c.tar.gz
rails-0ce641839aa59d8c8306ec21cfd5f31aaa9b169c.tar.bz2
rails-0ce641839aa59d8c8306ec21cfd5f31aaa9b169c.zip
Merge pull request #28083 from eileencodes/ensure-test-threads-shared-db-conn
Ensure test threads share a DB connection
Diffstat (limited to 'activerecord/test/cases/query_cache_test.rb')
-rw-r--r--activerecord/test/cases/query_cache_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb
index d8cf235000..494663eb04 100644
--- a/activerecord/test/cases/query_cache_test.rb
+++ b/activerecord/test/cases/query_cache_test.rb
@@ -532,4 +532,16 @@ class QueryCacheExpiryTest < ActiveRecord::TestCase
end
end
end
+
+ test "threads use the same connection" do
+ @connection_1 = ActiveRecord::Base.connection.object_id
+
+ thread_a = Thread.new do
+ @connection_2 = ActiveRecord::Base.connection.object_id
+ end
+
+ thread_a.join
+
+ assert_equal @connection_1, @connection_2
+ end
end