discourse/lib/autospec/simple_runner.rb
2013-10-24 12:08:03 +11:00

26 lines
521 B
Ruby

module Autospec
class SimpleRunner < BaseRunner
def abort
if @pid
Process.kill("SIGINT", @pid) rescue nil
while(Process.getpgid(@pid) rescue nil)
sleep 0.001
end
@pid = nil
end
end
def run(args, spec)
self.abort
puts "Running: " << spec
@pid = Process.spawn({"RAILS_ENV" => "test"}, "bundle exec rspec " << args.join(" "))
pid, status = Process.wait2(@pid)
status
end
def stop
self.abort
end
end
end