Sha256: ab12f77504414d26de13ccf0d83ed1db6b75e15a2fcf5448fb1054409e65dfb3
Contents?: true
Size: 1.22 KB
Versions: 11
Compression:
Stored size: 1.22 KB
Contents
require 'assert' require 'qs/process_signal' require 'qs/daemon' require 'test/support/pid_file_spy' class Qs::ProcessSignal class UnitTests < Assert::Context desc "Qs::ProcessSignal" setup do @daemon = TestDaemon.new @signal = Factory.string @pid_file_spy = PIDFileSpy.new(Factory.integer) Assert.stub(Qs::PIDFile, :new).with(@daemon.pid_file) do @pid_file_spy end @process_signal = Qs::ProcessSignal.new(@daemon, @signal) end subject{ @process_signal } should have_readers :signal, :pid should have_imeths :send should "know its signal and pid" do assert_equal @signal, subject.signal assert_equal @pid_file_spy.pid, subject.pid end end class SendTests < UnitTests desc "when sent" setup do @kill_called = false Assert.stub(::Process, :kill).with(@signal, @pid_file_spy.pid) do @kill_called = true end @process_signal.send end should "have used process kill to send the signal to the PID" do assert_true @kill_called end end class TestDaemon include Qs::Daemon name Factory.string pid_file Factory.file_path queue Qs::Queue.new{ name Factory.string } end end
Version data entries
11 entries across 11 versions & 1 rubygems