diff options
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/ordered_hash_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/activesupport/test/ordered_hash_test.rb b/activesupport/test/ordered_hash_test.rb index 1521279437..d070206d44 100644 --- a/activesupport/test/ordered_hash_test.rb +++ b/activesupport/test/ordered_hash_test.rb @@ -198,4 +198,28 @@ class OrderedHashTest < Test::Unit::TestCase assert_same original, @ordered_hash assert_equal @other_ordered_hash.keys, @ordered_hash.keys end + + def test_each_after_yaml_serialization + values = [] + @deserialized_ordered_hash = YAML::load(YAML::dump(@ordered_hash)) + + @deserialized_ordered_hash.each {|key, value| values << value} + assert_equal @values, values + end + + def test_order_after_yaml_serialization + @deserialized_ordered_hash = YAML::load(YAML::dump(@ordered_hash)) + + assert_equal @keys, @deserialized_ordered_hash.keys + assert_equal @values, @deserialized_ordered_hash.values + end + + def test_order_after_yaml_serialization_with_nested_arrays + @ordered_hash[:array] = %w(a b c) + + @deserialized_ordered_hash = YAML::load(YAML::dump(@ordered_hash)) + + assert_equal @ordered_hash.keys, @deserialized_ordered_hash.keys + assert_equal @ordered_hash.values, @deserialized_ordered_hash.values + end end |