Changeset 3468
- Timestamp:
- 01/23/06 05:38:02 (4 years ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb (modified) (1 diff)
- trunk/activesupport/test/core_ext/hash_ext_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r3458 r3468 1 1 *SVN* 2 3 * Fix merge and dup for hashes with indifferent access #3404 [kenneth.miller@bitfield.net] 2 4 3 5 * Fix the requires in option_merger_test to unbreak AS tests. [Sam Stephenson] trunk/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb
r3388 r3468 42 42 end 43 43 44 def dup 45 HashWithIndifferentAccess.new(self) 46 end 47 48 def merge(hash) 49 self.dup.update(hash) 50 end 51 44 52 protected 45 53 def convert_key(key) trunk/activesupport/test/core_ext/hash_ext_test.rb
r3388 r3468 117 117 end 118 118 119 def test_indifferent_merging 120 hash = HashWithIndifferentAccess.new 121 hash[:a] = 'failure' 122 hash['b'] = 'failure' 123 124 other = { 'a' => 1, :b => 2 } 125 126 merged = hash.merge(other) 127 128 assert_equal HashWithIndifferentAccess, merged.class 129 assert_equal 1, merged[:a] 130 assert_equal 2, merged['b'] 131 132 hash.update(other) 133 134 assert_equal 1, hash[:a] 135 assert_equal 2, hash['b'] 136 end 137 119 138 def test_assert_valid_keys 120 139 assert_nothing_raised do