Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 1d55e07ff9531890a54d8dc0449e848352064e9e 1 parent 227cfe5
@jonleighton jonleighton authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 activesupport/lib/active_support/testing/isolation.rb
View
10 activesupport/lib/active_support/testing/isolation.rb
@@ -88,10 +88,14 @@ def self.forking_env?
!ENV["NO_FORK"] && ((RbConfig::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/))
end
+ @@class_setup_mutex = Mutex.new
+
def _run_class_setup # class setup method should only happen in parent
- unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST']
- self.class.setup if self.class.respond_to?(:setup)
- @@ran_class_setup = true
+ @@class_setup_mutex.synchronize do
+ unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST']
+ self.class.setup if self.class.respond_to?(:setup)
+ @@ran_class_setup = true
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.