public
Rubygem
Description: Ruby process monitor
Homepage: http://god.rubyforge.org
Clone URL: git://github.com/mojombo/god.git
Click here to lend your support to: god and make a donation at www.pledgie.com !
mojombo (author)
Tue May 13 22:08:49 -0700 2008
commit  b3b55b5794e816d1b20e7a6908551f2430d7403f
tree    6c4c1ba8e10ab28d48193f6c2ad9cace8970a2d1
parent  4f12e1ceb12a9da7444a4de3572b3288f623276b
god / test / test_system_process.rb
100644 31 lines (23 sloc) 0.681 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require File.dirname(__FILE__) + '/helper'
 
class TestSystemProcess < Test::Unit::TestCase
  def setup
    pid = Process.pid
    @process = System::Process.new(pid)
  end
  
  def test_exists_should_return_true_for_running_process
    assert_equal true, @process.exists?
  end
  
  def test_exists_should_return_false_for_non_existant_process
    assert_equal false, System::Process.new(9999999).exists?
  end
  
  def test_memory
    assert_kind_of Integer, @process.memory
    assert @process.memory > 0
  end
  
  def test_percent_memory
    assert_kind_of Float, @process.percent_memory
  end
  
  def test_percent_cpu
    assert_kind_of Float, @process.percent_cpu
  end
end