10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/like_a_virgin/world.rb', line 10
def self.emit(files)
number, world = @cycle.next
world.try :join
stream = $stdout
pid = fork do
$stdout = stream
$stderr = stream
LikeAVirgin.stop
ENV["TEST_ENV_NUMBER"] = number.to_s || ""
ActiveRecord::Base.configurations = Rails.configuration.database_configuration
ActiveRecord::Base.establish_connection
ARGV.clear
ARGV.push files.shift while !files.empty?
ARGV.push "-O"
ARGV.push "spec/spec.opts"
require "spec/spec_helper"
Spec::Runner.run
exit
end
exit 1 if pid.nil?
@worlds[number] = Thread.new { Process.waitpid pid }
end
|