Sha256: bad9a6b19b138f5b21121a376924d9eb0fdca60a93f5b733a2e42cbb44b584ab

Contents?: true

Size: 1.11 KB

Versions: 17

Compression:

Stored size: 1.11 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')
    assert_equal false, c.valid?
  end
  
  def test_valid_should_return_false_if_no_mount_point_given
    c = Conditions::DiskUsage.new
    c.above = 90
    c.watch = stub(:name => 'foo')
    assert_equal false, c.valid?
  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

17 entries across 17 versions & 4 rubygems

Version Path
mojombo-god-0.7.20 test/test_conditions_disk_usage.rb
firenxis-god-0.11.0 test/test_conditions_disk_usage.rb
god-0.11.0 test/test_conditions_disk_usage.rb
god-0.10.1 test/test_conditions_disk_usage.rb
god-0.9.0 test/test_conditions_disk_usage.rb
olgen-god-0.9.2 test/test_conditions_disk_usage.rb
olgen-god-0.9.1 test/test_conditions_disk_usage.rb
olgen-god-0.9.0 test/test_conditions_disk_usage.rb
god-0.8.0 test/test_conditions_disk_usage.rb
olgen-god-0.8.2 test/test_conditions_disk_usage.rb
olgen-god-0.8.1 test/test_conditions_disk_usage.rb
olgen-god-0.8.0 test/test_conditions_disk_usage.rb
god-0.7.22 test/test_conditions_disk_usage.rb
god-0.7.21 test/test_conditions_disk_usage.rb
god-0.7.20 test/test_conditions_disk_usage.rb
god-0.7.19 test/test_conditions_disk_usage.rb
god-0.7.18 test/test_conditions_disk_usage.rb