Sha256: 75eebf7f68996b7cdc7c55911516b0b9d414d1c482ade2e8ce87370615482bea

Contents?: true

Size: 1.12 KB

Versions: 15

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 => 123, :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

15 entries across 15 versions & 8 rubygems

Version Path
dosire-god-0.7.10 test/test_conditions_process_running.rb
dosire-god-0.7.12 test/test_conditions_process_running.rb
dosire-god-0.7.9 test/test_conditions_process_running.rb
dustin-god-0.7.7.1 test/test_conditions_process_running.rb
eric-god-0.7.7 test/test_conditions_process_running.rb
gohanlonllc-god-0.7.9 test/test_conditions_process_running.rb
jwilkins-god-0.7.9 test/test_conditions_process_running.rb
mojombo-god-0.7.7 test/test_conditions_process_running.rb
saimonmoore-god-0.7.9 test/test_conditions_process_running.rb
god-0.7.0 test/test_conditions_process_running.rb
god-0.7.6 test/test_conditions_process_running.rb
god-0.7.5 test/test_conditions_process_running.rb
god-0.7.3 test/test_conditions_process_running.rb
god-0.7.7 test/test_conditions_process_running.rb
god-0.7.8 test/test_conditions_process_running.rb