Sha256: 090eb3e0f24a9500218f58508f232cad2591afcbea5d8ec6288a19c5b662ff3c

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

require "spec_helper"

describe "daemonzier after start" do

  before :each do
    @pid_files = simple_daemonfile(
             :name => :test1,
             :pid_file =>"#{tmp_dir}/test1.pid",
             :on_start => "loop { sleep 1 }",
             :workers => 3,
             :poll_period => 1)
    daemonizer :start
    sleep 8
  end

  after :each do
    daemonizer :stop
  end

  it "should create 3 forks" do
    children_count(pid(@pid_files[0])).should == 3
  end

  describe "after one worker died" do
    before :each do
      Process.kill("KILL", children_pids(pid(@pid_files[0])).first.to_i)
      sleep 5
    end

    it "should restore it" do
      children_count(pid(@pid_files[0])).should == 3
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
daemonizer-0.5.0.beta.1 spec/common/forking_spec.rb