Sha256: 0f6ff8c89dba32bc2e5f409d10e3f99fed34999a337ff5e25cb3ba3c23439756
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
require 'spec/autorun' require 'sane' require_rel '../lib/after' describe After do def go how_many = 1 pid = Process.spawn "ruby ./sleep.rb #{how_many}" Thread.new { Process.wait pid } # wait for it, so we can collect child processes, too pid end it "should be able to grab the right pid" do pid = go a = After.find_pids('sleep') a[0].should == pid end it "should immediately return if the other process doesn't exist" do a = After.find_pids('non existent process') assert a.empty? end it "should wait for another process to terminate" do go start = Time.now After.find_and_wait_for('sleep') assert (Time.now - start) > 0.5 end it "should work if there are several available" do go 1 go 2 go 3 start = Time.now After.find_and_wait_for('sleep') assert (Time.now - start) > 2 end it "should split the commands up right and across name, too" it "should respect name" it "should not return the PID of this process" do a = After.find_pids('ruby') assert !Process.pid.in?(a) end it "should run all args" do go 0 end it "should allow for passing in a pid" do pid = go 1 After.wait_pid pid end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
after-0.3.1 | spec/spec.after.rb |