Sha256: 015d9187b68ac6510545a6e6201294edd69795e7418ca3ca096ada736e0d494d

Contents?: true

Size: 1.12 KB

Versions: 36

Compression:

Stored size: 1.12 KB

Contents

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

class TestConditionsProcessRunning < Test::Unit::TestCase
  def test_missing_pid_file_returns_opposite
    [true, false].each do |r|
      c = Conditions::ProcessRunning.new
      c.running = r
    
      c.stubs(:watch).returns(stub(:pid => 99999999, :name => 'foo'))
    
      # no_stdout do
        assert_equal !r, c.test
      # end
    end
  end
  
  def test_not_running_returns_opposite
    [true, false].each do |r|
      c = Conditions::ProcessRunning.new
      c.running = r
    
      File.stubs(:exist?).returns(true)
      c.stubs(:watch).returns(stub(:pid => 123))
      File.stubs(:read).returns('5')
      System::Process.any_instance.stubs(:exists?).returns(false)
    
      assert_equal !r, c.test
    end
  end
  
  def test_running_returns_same
    [true, false].each do |r|
      c = Conditions::ProcessRunning.new
      c.running = r
    
      File.stubs(:exist?).returns(true)
      c.stubs(:watch).returns(stub(:pid => 123))
      File.stubs(:read).returns('5')
      System::Process.any_instance.stubs(:exists?).returns(true)
    
      assert_equal r, c.test
    end
  end
end

Version data entries

36 entries across 36 versions & 15 rubygems

Version Path
dguettler-god-0.7.13.2 test/test_conditions_process_running.rb
dguettler-god-0.7.13.3 test/test_conditions_process_running.rb
dunedain289-god-0.7.12.1 test/test_conditions_process_running.rb
eric-god-0.7.10 test/test_conditions_process_running.rb
eric-god-0.7.11 test/test_conditions_process_running.rb
eric-god-0.7.12 test/test_conditions_process_running.rb
eric-god-0.7.14 test/test_conditions_process_running.rb
fotonauts-god-0.7.10 test/test_conditions_process_running.rb
fotonauts-god-0.7.12 test/test_conditions_process_running.rb
gordoncww-god-0.7.11.1 test/test_conditions_process_running.rb
jreynolds-god-0.7.13 test/test_conditions_process_running.rb
mathieuravaux-god-0.7.11 test/test_conditions_process_running.rb
mojombo-god-0.7.10 test/test_conditions_process_running.rb
mojombo-god-0.7.11 test/test_conditions_process_running.rb
mojombo-god-0.7.12 test/test_conditions_process_running.rb
mojombo-god-0.7.13 test/test_conditions_process_running.rb
mojombo-god-0.7.14 test/test_conditions_process_running.rb
mojombo-god-0.7.15 test/test_conditions_process_running.rb
mojombo-god-0.7.16 test/test_conditions_process_running.rb
mojombo-god-0.7.9 test/test_conditions_process_running.rb