Class: Spork::RunStrategy::Forking

Inherits:
Spork::RunStrategy show all
Defined in:
lib/spork/run_strategy/forking.rb

Instance Attribute Summary

Attributes inherited from Spork::RunStrategy

#test_framework

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Spork::RunStrategy

#cleanup, #initialize

Constructor Details

This class inherits a constructor from Spork::RunStrategy

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/spork/run_strategy/forking.rb', line 2

def self.available?
  Kernel.respond_to?(:fork)
end

Instance Method Details

#abortObject



18
19
20
# File 'lib/spork/run_strategy/forking.rb', line 18

def abort
  @child && @child.abort
end

#preloadObject



22
23
24
# File 'lib/spork/run_strategy/forking.rb', line 22

def preload
  test_framework.preload
end

#run(argv, stderr, stdout) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/spork/run_strategy/forking.rb', line 6

def run(argv, stderr, stdout)
  abort if running?

  @child = ::Spork::Forker.new do
    $stdout, $stderr = stdout, stderr
    load test_framework.helper_file
    Spork.exec_each_run
    test_framework.run_tests(argv, stderr, stdout)
  end
  @child.result
end

#running?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/spork/run_strategy/forking.rb', line 26

def running?
  @child && @child.running?
end