1 require File.dirname(__FILE__) + '/helper'
3 class TestConditionsDiskUsage < Test::Unit::TestCase
6 def test_valid_should_return_false_if_no_above_given
7 c = Conditions::DiskUsage.new
9 c.watch = stub(:name => 'foo')
12 assert_equal false, c.valid?
16 def test_valid_should_return_false_if_no_mount_point_given
17 c = Conditions::DiskUsage.new
19 c.watch = stub(:name => 'foo')
22 assert_equal false, c.valid?
26 def test_valid_should_return_true_if_required_options_all_set
27 c = Conditions::DiskUsage.new
30 c.watch = stub(:name => 'foo')
32 assert_equal true, c.valid?
37 def test_test_should_return_true_if_above_limit
38 c = Conditions::DiskUsage.new
42 c.expects(:`).returns('91')
44 assert_equal true, c.test
47 def test_test_should_return_false_if_below_limit
48 c = Conditions::DiskUsage.new
52 c.expects(:`).returns('90')
54 assert_equal false, c.test