require "spec_helper" class CallbacksSpecHandler < SpecHandler class < [ Proc.new { @before_prepare.touch }, Proc.new { @before_prepare.touch; @engine_state.become('before_prepare_invoked') } ], :after_prepare => [ Proc.new { @after_prepare.touch }, Proc.new { @after_prepare.touch; @engine_state.become('after_prepare_invoked') } ], :before_start => [ Proc.new { @before_start.touch }, Proc.new { @before_start.touch; @engine_state.become('before_start_invoked') } ] } @engine = Daemonizer::Engine.new(Daemonizer::Config.new(:pool, { :workers => 1, :pid_file =>"#{tmp_dir}/test1.pid", :log_file =>"#{tmp_dir}/test1.log", :callbacks => @callbacks, :handler => CallbacksSpecHandler })) @engine.run_prepare_with_callbacks do @engine.run_start_with_callbacks end end after :each do CallbacksSpecHandler.call_on_prepare = nil CallbacksSpecHandler.call_on_start = nil end end