Module: ActiveSupport::Testing::Isolation
  
  
  
  
  
  
  
  
  
  
  
  
    - Defined in:
- activesupport/lib/active_support/testing/isolation.rb
 
Defined Under Namespace
  
    
      Modules: Forking, Subprocess
    
  
    
  
  
    
      Constant Summary
      collapse
    
    
      
        - SubprocessCrashed =
          
        
- Class.new(StandardError) 
      Class Method Summary
      collapse
    
    
  
    
      Instance Method Summary
      collapse
    
    
  
  
    Class Method Details
    
      
  
  
    .forking_env?  ⇒ Boolean 
  
  
  
  
    | 
16
17
18 | # File 'activesupport/lib/active_support/testing/isolation.rb', line 16
def self.forking_env?
  !ENV["NO_FORK"] && Process.respond_to?(:fork)
end | 
 
    
      
  
  
    .included(klass)  ⇒ Object 
  
  
  
  
  
    | 
10
11
12
13
14 | # File 'activesupport/lib/active_support/testing/isolation.rb', line 10
def self.included(klass)   klass.class_eval do
    parallelize_me! unless Minitest.parallel_executor.is_a?(ActiveSupport::Testing::ParallelizeExecutor)
  end
end | 
 
    
   
  
    Instance Method Details
    
      
  
  
    | 
20
21
22
23
24
25
26
27
28
29
30
31
32
33 | # 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 |