Sha256: 3da123f69a18427679013f08b91db20dc56464221720ca6101a7f19d7a0fe48b
Contents?: true
Size: 988 Bytes
Versions: 9
Compression:
Stored size: 988 Bytes
Contents
# # testing ruote # # Mon Aug 3 19:19:58 JST 2009 # require File.join(File.dirname(__FILE__), '..', 'test_helper.rb') require 'ruote/util/lookup' class LookupTest < Test::Unit::TestCase def test_lookup assert_equal(%w[ A B C ], Ruote.lookup({ 'h' => %w[ A B C ] }, 'h')) assert_equal('B', Ruote.lookup({ 'h' => %w[ A B C ] }, 'h.1')) end def test_container_lookup assert_equal( [ 'hh', { 'hh' => %w[ A B C ] } ], Ruote.lookup({ 'h' => { 'hh' => %w[ A B C ]} }, 'h.hh', true)) end def test_missing_container_lookup assert_equal( [ 'nada', nil ], Ruote.lookup({ 'h' => { 'hh' => %w[ A B C ]} }, 'nada.nada', true)) end def test_set h = { 'customer' => { 'name' => 'alpha' } } Ruote.set(h, 'customer.name', 'bravo') assert_equal({"customer"=>{"name"=>"bravo"}}, h) end def test_set_missing h = {} Ruote.set(h, 'customer.name', 'bravo') assert_equal({"customer.name"=>"bravo"}, h) end end
Version data entries
9 entries across 9 versions & 1 rubygems