Sha256: 2fc25ea73553e9c7987aa731bf4ee81e23d57bd7f0bf1e3a6769edcdd7d77c17
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
# coding: utf-8 require 'minitest/autorun' require 'confuse' # Test {Confuse::Namespace} class TestNamespace < MiniTest::Unit::TestCase def setup @namespace = Confuse::Namespace.new(nil) end def test_add_an_item @namespace.add_item(:foo, :default => :foo, :description => 'Test') refute_nil @namespace[:foo] end def test_to_hash namespace = Confuse::Namespace.new(nil) do |ns| ns.add_item :foo, :description => 'how many foos?', :default => 1 ns.add_item :bar, :description => 'how many bars?', :default => 2 end assert_equal( { :foo => { :description => 'how many foos?', :default => 1 }, :bar => { :description => 'how many bars?', :default => 2 } }, namespace.to_hash) end def test_to_hash_named_namespace namespace = Confuse::Namespace.new(:foo) do |ns| ns.add_item :foo, :description => 'how many foos?', :default => 1 ns.add_item :bar, :description => 'how many bars?', :default => 2 end assert_equal( { :foo_foo => { :description => 'how many foos?', :default => 1 }, :foo_bar => { :description => 'how many bars?', :default => 2 } }, namespace.to_hash) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
confuse-1.1.1 | test/test_namespace.rb |
confuse-1.1.0 | test/test_namespace.rb |