Sha256: 0bdcd388c2b8cd39ab60046f7887706a1af57739309d5c227e34c9fba734446a

Contents?: true

Size: 902 Bytes

Versions: 1

Compression:

Stored size: 902 Bytes

Contents

require 'spec/autorun'
require 'sane' # require_rel
require_rel '../lib/after'

describe After do

  def go how_many = 1
     pid = Process.spawn "ruby ./sleep.rb #{how_many}"
  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--if necessary"

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
after-0.0.2 test/spec.after.rb