Skip to content
This repository
Browse code

AS::Isolation functional on Windows/JRuby.

Doesn't make up for the fact that it's slooooooooow, though.

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information...
commit b549d93d2f34a18971e691ff93e4c5b7b092eb14 1 parent 7710a8c
Nick Sieger authored June 15, 2010 wycats committed June 24, 2010
19  activesupport/lib/active_support/testing/isolation.rb
@@ -45,12 +45,16 @@ def self.included(base)
45 45
         end
46 46
       end
47 47
 
  48
+      def _run_class_setup      # class setup method should only happen in parent
  49
+        unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST']
  50
+          self.class.setup if self.class.respond_to?(:setup)
  51
+          @@ran_class_setup = true
  52
+        end
  53
+      end
  54
+
48 55
       module TestUnit
49 56
         def run(result)
50  
-          unless defined?(@@ran_class_setup)
51  
-            self.class.setup if self.class.respond_to?(:setup)
52  
-            @@ran_class_setup = true
53  
-          end
  57
+          _run_class_setup
54 58
 
55 59
           yield(Test::Unit::TestCase::STARTED, name)
56 60
 
@@ -74,10 +78,7 @@ def run(result)
74 78
 
75 79
       module MiniTest
76 80
         def run(runner)
77  
-          unless defined?(@@ran_class_setup)
78  
-            self.class.setup if self.class.respond_to?(:setup)
79  
-            @@ran_class_setup = true
80  
-          end
  81
+          _run_class_setup
81 82
 
82 83
           serialized = run_in_isolation do |isolated_runner|
83 84
             super(isolated_runner)
@@ -109,6 +110,8 @@ def run_in_isolation(&blk)
109 110
       end
110 111
 
111 112
       module Subprocess
  113
+        ORIG_ARGV = ARGV.dup unless defined?(ORIG_ARGV)
  114
+
112 115
         # Crazy H4X to get this working in windows / jruby with
113 116
         # no forking.
114 117
         def run_in_isolation(&blk)
2  railties/test/abstract_unit.rb
... ...
@@ -1,5 +1,3 @@
1  
-ORIG_ARGV = ARGV.dup
2  
-
3 1
 require File.expand_path("../../../load_paths", __FILE__)
4 2
 
5 3
 require 'stringio'

0 notes on commit b549d93

Please sign in to comment.
Something went wrong with that request. Please try again.