From 821e15e5f2d9ef2aa43918a16cbd00f40c221e95 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 16 May 2010 15:20:52 -0300 Subject: Change on Array extension from rand => random_element [#4555 state:committed] Signed-off-by: Xavier Noria --- activesupport/test/core_ext/array_ext_test.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index e7617466c2..ebd6806416 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -358,15 +358,19 @@ class ArrayUniqByTests < Test::Unit::TestCase end end -class ArrayExtRandomTests < Test::Unit::TestCase +class ArrayExtRandomTests < ActiveSupport::TestCase def test_random_element_from_array - assert_nil [].rand + assert_nil [].random_element Kernel.expects(:rand).with(1).returns(0) - assert_equal 'x', ['x'].rand + assert_equal 'x', ['x'].random_element Kernel.expects(:rand).with(3).returns(1) - assert_equal 2, [1, 2, 3].rand + assert_equal 2, [1, 2, 3].random_element + end + + def test_deprecated_rand_on_array + assert_deprecated { [].rand } end end -- cgit v1.2.3