diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/Rakefile | 18 | ||||
-rw-r--r-- | activerecord/test/cases/unconnected_test.rb | 6 |
2 files changed, 21 insertions, 3 deletions
diff --git a/activerecord/Rakefile b/activerecord/Rakefile index be2380ebdc..f259ae7e12 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -80,9 +80,19 @@ end require "bundler/setup" unless defined?(Bundler) - # Every test file loads this first, so doing it post-fork gains - # us nothing. - require "cases/helper" + # Every test file loads "cases/helper" first, so doing it + # post-fork gains us nothing. + + # We need to dance around minitest autorun, though. + require "minitest" + Minitest.instance_eval do + alias _original_autorun autorun + def autorun + # no-op + end + require "cases/helper" + alias autorun _original_autorun + end failing_files = [] @@ -115,6 +125,8 @@ end ARGV.clear.concat test_options Rake.application = nil + Minitest.autorun + load file } diff --git a/activerecord/test/cases/unconnected_test.rb b/activerecord/test/cases/unconnected_test.rb index f0a0e7f805..49746996bc 100644 --- a/activerecord/test/cases/unconnected_test.rb +++ b/activerecord/test/cases/unconnected_test.rb @@ -11,6 +11,12 @@ class TestUnconnectedAdapter < ActiveRecord::TestCase def setup @underlying = ActiveRecord::Base.connection @specification = ActiveRecord::Base.remove_connection + + # Clear out connection info from other pids (like a fork parent) too + pool_map = ActiveRecord::Base.connection_handler.instance_variable_get(:@owner_to_pool) + (pool_map.keys - [Process.pid]).each do |other_pid| + pool_map.delete(other_pid) + end end teardown do |