Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Merge pull request #11712 from atambo/activesupport_testing_i…

…solation_jruby"

This reverts commit ff20910.

Needs more work on 4-0-stable to make these tests work with JRuby
  • Loading branch information...
commit 75d41df6c416d2922d0fde76ff68804dd361abb8 1 parent 1324e2e
Rafael Mendonça França rafaelfranca authored
Showing with 48 additions and 4 deletions.
  1. +48 −4 activesupport/lib/active_support/testing/isolation.rb
52 activesupport/lib/active_support/testing/isolation.rb
View
@@ -3,6 +3,49 @@
module ActiveSupport
module Testing
+ class RemoteError < StandardError
+
+ attr_reader :message, :backtrace
+
+ def initialize(exception)
+ @message = "caught #{exception.class.name}: #{exception.message}"
+ @backtrace = exception.backtrace
+ end
+ end
+
+ class ProxyTestResult
+ def initialize(calls = [])
+ @calls = calls
+ end
+
+ def add_error(e)
+ e = Test::Unit::Error.new(e.test_name, RemoteError.new(e.exception))
+ @calls << [:add_error, e]
+ end
+
+ def __replay__(result)
+ @calls.each do |name, args|
+ result.send(name, *args)
+ end
+ end
+
+ def marshal_dump
+ @calls
+ end
+
+ def marshal_load(calls)
+ initialize(calls)
+ end
+
+ def method_missing(name, *args)
+ @calls << [name, args]
+ end
+
+ def info_signal
+ Signal.list['INFO']
+ end
+ end
+
module Isolation
require 'thread'
@@ -69,18 +112,19 @@ def run_in_isolation(&blk)
require "tempfile"
if ENV["ISOLATION_TEST"]
- yield
+ proxy = ProxyTestResult.new
+ retval = yield proxy
File.open(ENV["ISOLATION_OUTPUT"], "w") do |file|
- file.puts [Marshal.dump(self.dup)].pack("m")
+ file.puts [Marshal.dump([retval, proxy])].pack("m")
end
exit!
else
Tempfile.open("isolation") do |tmpfile|
- ENV["ISOLATION_TEST"] = self.class.name
+ ENV["ISOLATION_TEST"] = @method_name
ENV["ISOLATION_OUTPUT"] = tmpfile.path
load_paths = $-I.map {|p| "-I\"#{File.expand_path(p)}\"" }.join(" ")
- `#{Gem.ruby} #{load_paths} #{$0} #{ORIG_ARGV.join(" ")}`
+ `#{Gem.ruby} #{load_paths} #{$0} #{ORIG_ARGV.join(" ")} -t\"#{self.class}\"`
ENV.delete("ISOLATION_TEST")
ENV.delete("ISOLATION_OUTPUT")
Please sign in to comment.
Something went wrong with that request. Please try again.