Sha256: 1e32bca8bf33529539606204e3092f5daed1792a514327db08fe4f3e4d14ed08
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
# coding: utf-8 class TestItem < MiniTest::Unit::TestCase def setup @item = Confuse::Item.new(:foo, :default => 1, :description => 'Description') end def test_sets_the_default_value assert_equal 1, @item.default(nil) end def test_sets_the_description assert_equal 'Description', @item.description end def test_required_item item = Confuse::Item.new(:foo, :description => 'required!', :required => true) assert_raises(Confuse::Errors::Undefined) { item.default(nil) } end def test_proc_as_default mock_conf = Class.new do def bar 'bar' end end.new item = Confuse::Item.new(:foo, :default => proc { |c| c.bar }) assert_equal 'bar', item.default(mock_conf) end def test_to_hash assert_equal({ :description => 'Description', :default => 1 }, @item.to_hash) end def test_default_false item = Confuse::Item.new(:foo, :default => false) assert_equal false, item.convert('false') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
confuse-1.1.1 | test/test_item.rb |