Sha256: 726aea0efcaad328a09bc4f46cf766ea0ea63261c66470625066eb3f36811bcc

Contents?: true

Size: 1.17 KB

Versions: 52

Compression:

Stored size: 1.17 KB

Contents

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

class TestConditionsDiskUsage < Test::Unit::TestCase
  # valid?
  
  def test_valid_should_return_false_if_no_above_given
    c = Conditions::DiskUsage.new
    c.mount_point = '/'
    c.watch = stub(:name => 'foo')
    
    no_stdout do
      assert_equal false, c.valid?
    end
  end
  
  def test_valid_should_return_false_if_no_mount_point_given
    c = Conditions::DiskUsage.new
    c.above = 90
    c.watch = stub(:name => 'foo')
    
    no_stdout do
      assert_equal false, c.valid?
    end
  end
  
  def test_valid_should_return_true_if_required_options_all_set
    c = Conditions::DiskUsage.new
    c.above = 90
    c.mount_point = '/'
    c.watch = stub(:name => 'foo')
    
    assert_equal true, c.valid?
  end
  
  # test
  
  def test_test_should_return_true_if_above_limit
    c = Conditions::DiskUsage.new
    c.above = 90
    c.mount_point = '/'
    
    c.expects(:`).returns('91')
    
    assert_equal true, c.test
  end
  
  def test_test_should_return_false_if_below_limit
    c = Conditions::DiskUsage.new
    c.above = 90
    c.mount_point = '/'
    
    c.expects(:`).returns('90')
    
    assert_equal false, c.test
  end
end

Version data entries

52 entries across 52 versions & 20 rubygems

Version Path
dguettler-god-0.7.13.2 test/test_conditions_disk_usage.rb
dguettler-god-0.7.13.3 test/test_conditions_disk_usage.rb
dosire-god-0.7.10 test/test_conditions_disk_usage.rb
dosire-god-0.7.12 test/test_conditions_disk_usage.rb
dosire-god-0.7.9 test/test_conditions_disk_usage.rb
dunedain289-god-0.7.12.1 test/test_conditions_disk_usage.rb
dustin-god-0.7.7.1 test/test_conditions_disk_usage.rb
eric-god-0.7.10 test/test_conditions_disk_usage.rb
eric-god-0.7.11 test/test_conditions_disk_usage.rb
eric-god-0.7.12 test/test_conditions_disk_usage.rb
eric-god-0.7.14 test/test_conditions_disk_usage.rb
eric-god-0.7.7 test/test_conditions_disk_usage.rb
fotonauts-god-0.7.10 test/test_conditions_disk_usage.rb
fotonauts-god-0.7.12 test/test_conditions_disk_usage.rb
gohanlonllc-god-0.7.9 test/test_conditions_disk_usage.rb
gordoncww-god-0.7.11.1 test/test_conditions_disk_usage.rb
jreynolds-god-0.7.13 test/test_conditions_disk_usage.rb
jwilkins-god-0.7.9 test/test_conditions_disk_usage.rb
mathieuravaux-god-0.7.11 test/test_conditions_disk_usage.rb
mojombo-god-0.7.10 test/test_conditions_disk_usage.rb