Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 36 lines (27 sloc) 0.997 kb
8555973 @JEG2 Adding configuration support.
authored
1 #!/usr/bin/env ruby -wKU
2
3 require "test/unit"
4
5 require "rrdb"
8e87e38 @JEG2 Supporting basic CRUD operations (minus Delete).
authored
6 require File.join(File.dirname(__FILE__), "rrd_manager")
8555973 @JEG2 Adding configuration support.
authored
7
8 class TestConfig < Test::Unit::TestCase
8e87e38 @JEG2 Supporting basic CRUD operations (minus Delete).
authored
9 include RRDManager
8555973 @JEG2 Adding configuration support.
authored
10
11 def test_config_is_a_hash_with_defaults
12 assert_instance_of(Hash, RRDB.config)
13 assert_not_nil(RRDB.config[:reserve_fields])
14 end
15
16 def test_alternative_interface_to_access_config_values
17 assert_equal(RRDB.config[:reserve_fields], RRDB.config(:reserve_fields))
18 end
19
20 def test_adding_new_values_to_the_config
21 assert_nil(RRDB.config[:config_value_from_tests])
22 RRDB.config(:config_value_from_tests => true)
23 assert_not_nil(RRDB.config[:config_value_from_tests])
24 end
25
26 def test_updating_the_config
27 old_value = RRDB.config[:reserve_fields]
28 RRDB.config(:reserve_fields => old_value.to_i + 1)
29 assert_not_equal(old_value, RRDB.config[:reserve_fields])
30 end
31
32 def test_config_tries_to_locate_rrdtool
33 assert_match(/\brrdtool\z/, RRDB.config[:rrdtool_path])
34 end
35 end
Something went wrong with that request. Please try again.