Browse files

Version bump to 0.5.2

  • Loading branch information...
1 parent 8de4403 commit 1fc61e38fb66473b14250d76c58f750ba3544157 Jacob Harris committed Apr 15, 2010
Showing with 27 additions and 2 deletions.
  1. +1 −1 VERSION
  2. +7 −1 lib/lifeline.rb
  3. +19 −0 test/test_lifeline.rb
View
2 VERSION
@@ -1 +1 @@
-0.5.1
+0.5.2
View
8 lib/lifeline.rb
@@ -4,8 +4,14 @@
module Lifeline
##
# @private
+ def get_processes_from_shell
+ %x{ps ax -o pid,command}
+ end
+
+ ##
+ # @private
def get_process_list
- processes = %x{ps ax -o pid,command}
+ processes = get_processes_from_shell
return nil if processes.nil?
View
19 test/test_lifeline.rb
@@ -18,6 +18,25 @@ class TestLifeline < Test::Unit::TestCase
assert_kind_of(String, p[:command])
end
end
+
+ context '' do
+ setup do
+ps_output = <<EOF
+ 2070 ps ax -o pid,command
+10096 searchd --pidfile --config /mnt/apps/doc_viewer/releases/20100329193155/config/internal_production.sphinx.conf
+EOF
+ self.expects(:get_processes_from_shell).returns(ps_output)
+ @processes = get_process_list
+ end
+
+ should "handle whitespace in the front of the PID correctly" do
+ assert @processes.any? {|x| x[:pid] == 2070}
+ end
+
+ should "handle a lack of whitespace in front of the PID correctly" do
+ assert @processes.any? {|x| x[:pid] == 10096}
+ end
+ end
end
context "lifeline" do

0 comments on commit 1fc61e3

Please sign in to comment.