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
god-0.7.10 test/test_conditions_disk_usage.rb
god-0.7.0 test/test_conditions_disk_usage.rb
god-0.7.11 test/test_conditions_disk_usage.rb
god-0.6.0 test/test_conditions_disk_usage.rb
god-0.7.7 test/test_conditions_disk_usage.rb
god-0.7.6 test/test_conditions_disk_usage.rb
god-0.7.5 test/test_conditions_disk_usage.rb
god-0.7.8 test/test_conditions_disk_usage.rb
god-0.7.13 test/test_conditions_disk_usage.rb
god-0.7.3 test/test_conditions_disk_usage.rb
god-0.7.12 test/test_conditions_disk_usage.rb
monitr-0.0.1 test/test_conditions_disk_usage.rb