4 require 'mcollective/unix_daemon'
8 describe "#daemonize_runner" do
9 it "should not run on the windows platform" do
10 Util.expects("windows?").returns(true)
11 expect { UnixDaemon.daemonize_runner }.to raise_error("The Unix Daemonizer can not be used on the Windows Platform")
14 it "should write the pid file if requested" do
16 f.expects(:write).with(Process.pid)
18 File.expects(:open).with("/nonexisting", "w").yields(f)
23 Runner.expects(:new).returns(r)
24 UnixDaemon.expects(:daemonize).yields
26 UnixDaemon.daemonize_runner("/nonexisting")
29 it "should not write a pid file unless requested" do
33 UnixDaemon.expects(:daemonize).yields
34 Runner.expects(:new).returns(r)
35 File.expects(:open).never
37 UnixDaemon.daemonize_runner(nil)