1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

The test setup is not threadsafe. Wrap in a mutex.

This commit is contained in:
Jon Leighton 2013-01-18 16:07:07 +00:00
parent 227cfe50c6
commit 1d55e07ff9

View file

@ -88,12 +88,16 @@ module ActiveSupport
!ENV["NO_FORK"] && ((RbConfig::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/)) !ENV["NO_FORK"] && ((RbConfig::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/))
end end
@@class_setup_mutex = Mutex.new
def _run_class_setup # class setup method should only happen in parent def _run_class_setup # class setup method should only happen in parent
@@class_setup_mutex.synchronize do
unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST'] unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST']
self.class.setup if self.class.respond_to?(:setup) self.class.setup if self.class.respond_to?(:setup)
@@ran_class_setup = true @@ran_class_setup = true
end end
end end
end
def run(runner) def run(runner)
_run_class_setup _run_class_setup