Sha256: f6e4c57998686e20408b0cdd9ab8dc17a3bb6d189eb8ee41dec140e861f4a2e7
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
require File.join(File.dirname(__FILE__), '..', 'helper') class TestMashExtensions < Test::Unit::TestCase def setup super @value = 'my value' end def test_convert_hash_with_camel_case_key hash = { 'CamelCaseKey' => @value } mash = Hashie::Mash.new(hash) assert_equal @value, mash['camel_case_key'] assert_equal @value, mash.camel_case_key end def test_convert_hash_with_uppercase_key hash = { 'UPPERCASEKEY' => @value } mash = Hashie::Mash.new(hash) assert_equal @value, mash['uppercasekey'] assert_equal @value, mash.uppercasekey end def test_convert_hash_with_camel_case_with_space_in_key hash = { 'CamelCase Key' => @value } mash = Hashie::Mash.new(hash) assert_equal @value, mash['camel_case_key'] assert_equal @value, mash.camel_case_key end def test_convert_hash_with_underscored_key hash = { 'already_underscored_key' => @value } mash = Hashie::Mash.new(hash) assert_equal @value, mash['already_underscored_key'] assert_equal @value, mash.already_underscored_key end def test_convert_nested_hash_with_camel_case_key hash = { 'CamelCaseKey1' => { 'CamelCaseKey2' => @value } } mash = Hashie::Mash.new(hash) assert_equal @value, mash['camel_case_key1']['camel_case_key2'] assert_equal @value, mash.camel_case_key1.camel_case_key2 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nextbus-0.0.1 | test/unit/test_mash_extensions.rb |
nextbus-0.0.0 | test/unit/test_mash_extensions.rb |