diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-03 19:10:33 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-03 19:10:33 -0800 |
commit | cb534524389bb4f407fc268a0bb7a7cffb6785a9 (patch) | |
tree | e928b2bdad77d63318613a155a20a0227866a427 /activesupport | |
parent | a242abbad8e2204a6ae7a4f8415abe71c9773a9c (diff) | |
download | rails-cb534524389bb4f407fc268a0bb7a7cffb6785a9.tar.gz rails-cb534524389bb4f407fc268a0bb7a7cffb6785a9.tar.bz2 rails-cb534524389bb4f407fc268a0bb7a7cffb6785a9.zip |
Fix OrderedHash#to_hash to return self instead of a new hash with self as default value
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/ordered_hash.rb | 2 | ||||
-rw-r--r-- | activesupport/test/ordered_hash_test.rb | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index 66aab9e562..d3cd2bcddd 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -54,7 +54,7 @@ module ActiveSupport end def to_hash - Hash.new(self) + self end def each_key diff --git a/activesupport/test/ordered_hash_test.rb b/activesupport/test/ordered_hash_test.rb index fb76ca1ab6..9c17145b9f 100644 --- a/activesupport/test/ordered_hash_test.rb +++ b/activesupport/test/ordered_hash_test.rb @@ -45,6 +45,10 @@ class OrderedHashTest < Test::Unit::TestCase assert_nil @ordered_hash.delete(bad_key) end + def test_to_hash + assert_same @ordered_hash, @ordered_hash.to_hash + end + def test_has_key assert_equal true, @ordered_hash.has_key?('blue') assert_equal true, @ordered_hash.key?('blue') @@ -148,4 +152,4 @@ class OrderedHashTest < Test::Unit::TestCase @ordered_hash.keys.pop assert_equal original, @ordered_hash.keys end -end
\ No newline at end of file +end |