123456789_123456789_123456789_123456789_123456789_

Module: ActiveSupport::Testing::Isolation

Relationships & Source Files
Namespace Children
Modules:
Defined in: activesupport/lib/active_support/testing/isolation.rb

Constant Summary

Class Attribute Summary

Class Method Summary

Instance Method Summary

Class Attribute Details

.forking_env?Boolean (readonly)

[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/isolation.rb', line 16

def self.forking_env?
  !ENV["NO_FORK"] && Process.respond_to?(:fork)
end

Class Method Details

.included(klass)

This method is for internal use only.
[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/isolation.rb', line 10

def self.included(klass) # :nodoc:
  klass.class_eval do
    parallelize_me! unless Minitest.parallel_executor.is_a?(ActiveSupport::Testing::ParallelizeExecutor)
  end
end

Instance Method Details

#run

[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/isolation.rb', line 20

def run
  status, serialized = run_in_isolation do
    super
  end

  unless status&.success?
    error = SubprocessCrashed.new("Subprocess exited with an error: #{status.inspect}\noutput: #{serialized.inspect}")
    error.set_backtrace(caller)
    self.failures << Minitest::UnexpectedError.new(error)
    return defined?(Minitest::Result) ? Minitest::Result.from(self) : dup
  end

  Marshal.load(serialized)
end