Sha256: 85593f884faac582cc5cd0bcfccef0020b34ba6edc0bb8666f11b525f1fefc43

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 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

7 entries across 7 versions & 1 rubygems

Version Path
god-0.13.4 test/test_conditions_disk_usage.rb
god-0.13.3 test/test_conditions_disk_usage.rb
god-0.13.2 test/test_conditions_disk_usage.rb
god-0.13.1 test/test_conditions_disk_usage.rb
god-0.13.0 test/test_conditions_disk_usage.rb
god-0.12.1 test/test_conditions_disk_usage.rb
god-0.12.0 test/test_conditions_disk_usage.rb