diff options
author | Vasiliy Ermolovich <younash@gmail.com> | 2011-12-22 19:30:10 +0300 |
---|---|---|
committer | Vasiliy Ermolovich <younash@gmail.com> | 2011-12-22 19:34:39 +0300 |
commit | c4df2d0b6e0c1f4e0df4a66bfae91a684f3d9f71 (patch) | |
tree | 9546bca07bee905320ba12ca415d38e8ed4cd82b /activesupport/test | |
parent | fa5adfb1e884bf21a7071ade634a820e37ac4db4 (diff) | |
download | rails-c4df2d0b6e0c1f4e0df4a66bfae91a684f3d9f71.tar.gz rails-c4df2d0b6e0c1f4e0df4a66bfae91a684f3d9f71.tar.bz2 rails-c4df2d0b6e0c1f4e0df4a66bfae91a684f3d9f71.zip |
deprecate Array#uniq_by and Array#uniq_by! in favor of Array#uniq and Array#uniq! from ruby 1.9
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/array_ext_test.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 6739b4afbd..278734027a 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -343,22 +343,30 @@ end 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 }) + ActiveSupport::Deprecation.silence do + 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 }) + end end def test_uniq_by! a = [1,2,3,4] - a.uniq_by! { |i| i.odd? } + ActiveSupport::Deprecation.silence do + a.uniq_by! { |i| i.odd? } + end assert_equal [1,2], a a = [1,2,3,4] - a.uniq_by! { |i| i.even? } + ActiveSupport::Deprecation.silence do + a.uniq_by! { |i| i.even? } + end assert_equal [1,2], a a = (-5..5).to_a - a.uniq_by! { |i| i**2 } + ActiveSupport::Deprecation.silence do + a.uniq_by! { |i| i**2 } + end assert_equal((-5..0).to_a, a) end end |