Sha256: c0230b1a4ed13564a5325ec8996662aa2827e402330d7a9b70551ef3cb435c88
Contents?: true
Size: 803 Bytes
Versions: 2
Compression:
Stored size: 803 Bytes
Contents
require 'test_helper' require 'lotus/utils/hash' describe Lotus::Utils::Hash do it 'acts as a Ruby standard Hash' do hash = Lotus::Utils::Hash.new hash.must_be_kind_of(::Hash) ::Hash.new.methods.each do |m| hash.must_respond_to(m) end end it 'holds values passed to the constructor' do hash = Lotus::Utils::Hash.new('foo' => 'bar') hash['foo'].must_equal('bar') end describe '#symbolize!' do it 'symbolize keys' do hash = Lotus::Utils::Hash.new('fub' => 'baz') hash.symbolize! hash['fub'].must_be_nil hash[:fub].must_equal('baz') end it 'symbolize nested hashes' do hash = Lotus::Utils::Hash.new('nested' => {'key' => 'value'}) hash.symbolize! hash[:nested][:key].must_equal('value') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lotus-utils-0.1.1 | test/hash_test.rb |
lotus-utils-0.1.0 | test/hash_test.rb |