diff options
author | chaitanyav <me@chaitanyavellanki.com> | 2010-06-26 01:52:20 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-26 12:05:25 +0200 |
commit | 9958950f78638e4a6c6800404d84f22effc0748e (patch) | |
tree | a1c96fd8cae120ae64f68eaf916ba7f424be7460 /activesupport/test | |
parent | d4e1a2ef0d35f322803284a980575fc31ff7b4b6 (diff) | |
download | rails-9958950f78638e4a6c6800404d84f22effc0748e.tar.gz rails-9958950f78638e4a6c6800404d84f22effc0748e.tar.bz2 rails-9958950f78638e4a6c6800404d84f22effc0748e.zip |
Add OrderedHash#invert to preserve order in ruby 1.8 [#4875]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/ordered_hash_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/test/ordered_hash_test.rb b/activesupport/test/ordered_hash_test.rb index f3d2ec0286..fc467b41de 100644 --- a/activesupport/test/ordered_hash_test.rb +++ b/activesupport/test/ordered_hash_test.rb @@ -257,4 +257,10 @@ class OrderedHashTest < Test::Unit::TestCase @updated_ordered_hash.update(:name => "Bob") assert_equal [:name], @updated_ordered_hash.keys end + + def test_invert + @ordered_hash = ActiveSupport::OrderedHash[[["foo", "FOO"], ["bar", "BAR"]]] + @inverted_ordered_hash = @ordered_hash.invert + assert_equal [["FOO", "foo"], ["BAR", "bar"]], @inverted_ordered_hash.to_a + end end |