Class Index [+]

Quicksearch

ActiveSupport::Testing::Isolation::Subprocess

Constants

ORIG_ARGV

Public Instance Methods

run_in_isolation(&blk) click to toggle source

Crazy H4X to get this working in windows / jruby with no forking.

     # File lib/active_support/testing/isolation.rb, line 117
117:         def run_in_isolation(&blk)
118:           require "tempfile"
119: 
120:           if ENV["ISOLATION_TEST"]
121:             proxy = ProxyTestResult.new
122:             retval = yield proxy
123:             File.open(ENV["ISOLATION_OUTPUT"], "w") do |file|
124:               file.puts [Marshal.dump([retval, proxy])].pack("m")
125:             end
126:             exit!
127:           else
128:             Tempfile.open("isolation") do |tmpfile|
129:               ENV["ISOLATION_TEST"]   = @method_name
130:               ENV["ISOLATION_OUTPUT"] = tmpfile.path
131: 
132:               load_paths = $-I.map {|p| "-I\"#{File.expand_path(p)}\"" }.join(" ")
133:               `#{Gem.ruby} #{load_paths} #{$0} #{ORIG_ARGV.join(" ")} -t\"#{self.class}\"`
134: 
135:               ENV.delete("ISOLATION_TEST")
136:               ENV.delete("ISOLATION_OUTPUT")
137: 
138:               return tmpfile.read.unpack("m")[0]
139:             end
140:           end
141:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.