Sha256: 91ea74c445b4d1dda9585bd8777441d4f2e1548f44703cb7ec647aaac61cac12
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb') require 'rbbt/util/config' class TestConfig < Test::Unit::TestCase def setup Rbbt::Config.set({:cpus => 30}, :test_config, :test) Rbbt::Config.set(:cpus , 5, "slow::2", :test) end def test_simple assert_equal 30, Rbbt::Config.get(:cpus, :test_config) end def test_prio assert_equal 5, Rbbt::Config.get(:cpus, :slow, :test) end def test_with_config Rbbt::Config.add_entry 'key', 'valueA', 'token' assert_equal "valueA", Rbbt::Config.get('key', 'token') assert_equal "default", Rbbt::Config.get('key2', 'token', :default => 'default') Rbbt::Config.with_config do Rbbt::Config.add_entry 'key', 'valueB', 'token' Rbbt::Config.add_entry 'key2', 'valueB2', 'token' assert_equal "valueB", Rbbt::Config.get('key', 'token') assert_equal "valueB2", Rbbt::Config.get('key2', 'token', :default => 'default') end assert_equal "valueA", Rbbt::Config.get('key', 'token') assert_equal "default", Rbbt::Config.get('key2', 'token', :default => 'default') end def test_order Rbbt::Config.add_entry 'key', 'V1', 'token1' Rbbt::Config.add_entry 'key', 'V2', 'token2' Rbbt::Config.add_entry 'key', 'V3', 'token2' assert_equal "V3", Rbbt::Config.get('key', 'token2') assert_equal "V1", Rbbt::Config.get('key', 'token1') assert_equal "V3", Rbbt::Config.get('key', 'token2', 'token1') assert_equal "V1", Rbbt::Config.get('key', 'token1', 'token2') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rbbt-util-5.26.147 | test/rbbt/util/test_config.rb |