aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/ordered_hash_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-01-04 15:01:51 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-04 15:07:15 -0800
commit4fabad7cf125178c95468a573951e587928c333b (patch)
tree84a1031ee49501d47e835d7ddb43e451e0bdc9cd /activesupport/test/ordered_hash_test.rb
parenta84b84efaca02a0164c32a10df59f581eef16ac8 (diff)
downloadrails-4fabad7cf125178c95468a573951e587928c333b.tar.gz
rails-4fabad7cf125178c95468a573951e587928c333b.tar.bz2
rails-4fabad7cf125178c95468a573951e587928c333b.zip
test that the custom ordered hash can be round-tripped
Diffstat (limited to 'activesupport/test/ordered_hash_test.rb')
-rw-r--r--activesupport/test/ordered_hash_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/activesupport/test/ordered_hash_test.rb b/activesupport/test/ordered_hash_test.rb
index 69f24dd6f8..09203465c3 100644
--- a/activesupport/test/ordered_hash_test.rb
+++ b/activesupport/test/ordered_hash_test.rb
@@ -261,6 +261,23 @@ class OrderedHashTest < Test::Unit::TestCase
assert_equal @ordered_hash.values, @deserialized_ordered_hash.values
end
+ begin
+ require 'psych'
+
+ def test_psych_serialize
+ @deserialized_ordered_hash = Psych.load(Psych.dump(@ordered_hash))
+
+ values = @deserialized_ordered_hash.map { |_, value| value }
+ assert_equal @values, values
+ end
+
+ def test_psych_serialize_tag
+ yaml = Psych.dump(@ordered_hash)
+ assert_match '!omap', yaml
+ end
+ rescue LoadError
+ end
+
def test_has_yaml_tag
@ordered_hash[:array] = %w(a b c)
assert_match '!omap', YAML.dump(@ordered_hash)