aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2013-01-18 16:07:07 +0000
committerJon Leighton <j@jonathanleighton.com>2013-01-18 16:07:07 +0000
commit1d55e07ff9531890a54d8dc0449e848352064e9e (patch)
tree3fec808b6933719d00c95bcfc1806fe61ca35a70 /activesupport/lib/active_support
parent227cfe50c60190428be3a0b4ed4521a283ee03cf (diff)
downloadrails-1d55e07ff9531890a54d8dc0449e848352064e9e.tar.gz
rails-1d55e07ff9531890a54d8dc0449e848352064e9e.tar.bz2
rails-1d55e07ff9531890a54d8dc0449e848352064e9e.zip
The test setup is not threadsafe. Wrap in a mutex.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/testing/isolation.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/testing/isolation.rb b/activesupport/lib/active_support/testing/isolation.rb
index f7a92ce03b..e4f8959e7a 100644
--- a/activesupport/lib/active_support/testing/isolation.rb
+++ b/activesupport/lib/active_support/testing/isolation.rb
@@ -88,10 +88,14 @@ module ActiveSupport
!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