From e0ba9acac15493fc242b56699972756a002fb952 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 5 Feb 2010 00:07:50 -0800 Subject: [PATCH] fixing test warnings, reducing yaml api footprint --- activesupport/lib/active_support/ordered_hash.rb | 8 ++++---- activesupport/test/core_ext/array_ext_test.rb | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index 57ead35..3ac46f4 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -143,13 +143,13 @@ module ActiveSupport end class OrderedHash #:nodoc: - def to_yaml_type - "!tag:yaml.org,2002:omap" - end + YAML_TAG = "tag:yaml.org,2002:omap" + + yaml_as YAML_TAG def to_yaml(opts = {}) YAML.quick_emit(self, opts) do |out| - out.seq(taguri, to_yaml_style) do |seq| + out.seq(YAML_TAG, nil) do |seq| each do |k, v| seq.add(k => v) end diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index d4cd5dd..b374eca 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -306,7 +306,7 @@ class ArrayUniqByTests < Test::Unit::TestCase def test_uniq_by assert_equal [1,2], [1,2,3,4].uniq_by { |i| i.odd? } assert_equal [1,2], [1,2,3,4].uniq_by(&:even?) - assert_equal (-5..0).to_a, (-5..5).to_a.uniq_by{ |i| i**2 } + assert_equal((-5..0).to_a, (-5..5).to_a.uniq_by{ |i| i**2 }) end def test_uniq_by! @@ -320,7 +320,7 @@ class ArrayUniqByTests < Test::Unit::TestCase a = (-5..5).to_a a.uniq_by! { |i| i**2 } - assert_equal (-5..0).to_a, a + assert_equal((-5..0).to_a, a) end end -- 1.6.6