aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-05-16 15:20:52 -0300
committerXavier Noria <fxn@hashref.com>2010-05-16 22:23:44 +0200
commit821e15e5f2d9ef2aa43918a16cbd00f40c221e95 (patch)
treedeb326567a2f383afd37b20f231f490d67c8ac82 /activesupport/test/core_ext
parent64d109e3539ad600f58536d3ecabd2f87b67fd1c (diff)
downloadrails-821e15e5f2d9ef2aa43918a16cbd00f40c221e95.tar.gz
rails-821e15e5f2d9ef2aa43918a16cbd00f40c221e95.tar.bz2
rails-821e15e5f2d9ef2aa43918a16cbd00f40c221e95.zip
Change on Array extension from rand => random_element [#4555 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/array_ext_test.rb12
1 files changed, 8 insertions, 4 deletions
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