aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
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 /activerecord
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 'activerecord')
-rw-r--r--activerecord/test/cases/associations/eager_load_nested_include_test.rb14
-rw-r--r--activerecord/test/cases/named_scope_test.rb2
2 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/test/cases/associations/eager_load_nested_include_test.rb b/activerecord/test/cases/associations/eager_load_nested_include_test.rb
index e8db6d5dab..2beb3f8365 100644
--- a/activerecord/test/cases/associations/eager_load_nested_include_test.rb
+++ b/activerecord/test/cases/associations/eager_load_nested_include_test.rb
@@ -17,7 +17,7 @@ module Remembered
module ClassMethods
def remembered; @@remembered ||= []; end
- def rand; @@remembered.rand; end
+ def random_element; @@remembered.random_element; end
end
end
@@ -79,14 +79,14 @@ class EagerLoadPolyAssocsTest < ActiveRecord::TestCase
[Circle, Square, Triangle, NonPolyOne, NonPolyTwo].map(&:create!)
end
1.upto(NUM_SIMPLE_OBJS) do
- PaintColor.create!(:non_poly_one_id => NonPolyOne.rand.id)
- PaintTexture.create!(:non_poly_two_id => NonPolyTwo.rand.id)
+ PaintColor.create!(:non_poly_one_id => NonPolyOne.random_element.id)
+ PaintTexture.create!(:non_poly_two_id => NonPolyTwo.random_element.id)
end
1.upto(NUM_SHAPE_EXPRESSIONS) do
- shape_type = [Circle, Square, Triangle].rand
- paint_type = [PaintColor, PaintTexture].rand
- ShapeExpression.create!(:shape_type => shape_type.to_s, :shape_id => shape_type.rand.id,
- :paint_type => paint_type.to_s, :paint_id => paint_type.rand.id)
+ shape_type = [Circle, Square, Triangle].random_element
+ paint_type = [PaintColor, PaintTexture].random_element
+ ShapeExpression.create!(:shape_type => shape_type.to_s, :shape_id => shape_type.random_element.id,
+ :paint_type => paint_type.to_s, :paint_id => paint_type.random_element.id)
end
end
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb
index 9db0e7c143..2007f5492f 100644
--- a/activerecord/test/cases/named_scope_test.rb
+++ b/activerecord/test/cases/named_scope_test.rb
@@ -301,7 +301,7 @@ class NamedScopeTest < ActiveRecord::TestCase
end
def test_rand_should_select_a_random_object_from_proxy
- assert_kind_of Topic, Topic.approved.rand
+ assert_kind_of Topic, Topic.approved.random_element
end
def test_should_use_where_in_query_for_named_scope