Sha256: e3c596529e38fce3419292ba809f2b70b8e42abf5240920009c803ebe392f393

Contents?: true

Size: 674 Bytes

Versions: 5

Compression:

Stored size: 674 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

unit_tests do
  test "running? is true if sending kill(0, pid) does not fail" do
    warlock = DeepTest::Warlock.new
    Process.expects(:kill).with(0, :pid)
    assert_equal true, warlock.running?(:pid)
  end
  
  test "running? is false if Process.kill(0, pid) raises Errno::ESRCH" do
    warlock = DeepTest::Warlock.new
    Process.stubs(:kill).raises(Errno::ESRCH)
    assert_equal false, warlock.running?(:pid)
  end
  
  test "running? is true if Process.kill raises Exception" do
    warlock = DeepTest::Warlock.new
    Process.stubs(:kill).raises(Exception)
    assert_equal true, warlock.running?(:pid)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
deep_test-1.1.0 test/deep_test/warlock_test.rb
deep_test-1.1.2 test/deep_test/warlock_test.rb
deep_test-1.1.3 test/deep_test/warlock_test.rb
deep_test-1.1.1 test/deep_test/warlock_test.rb
deep_test-1.1.4 test/deep_test/warlock_test.rb