aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2018-09-19 14:31:12 -0400
committerRafael Mendonça França <rafaelmfranca@gmail.com>2018-09-19 14:32:18 -0400
commite184d1a94e3ecfbc22823fbb9097992158a40cb2 (patch)
tree141065394a633772edfd13dbecd11bab5eba1261 /activerecord/test/cases/finder_test.rb
parent1b90f614b1b3d06b7f02a8b9ea6cd84f15d58643 (diff)
downloadrails-e184d1a94e3ecfbc22823fbb9097992158a40cb2.tar.gz
rails-e184d1a94e3ecfbc22823fbb9097992158a40cb2.tar.bz2
rails-e184d1a94e3ecfbc22823fbb9097992158a40cb2.zip
Don't return the same object when using find with an empty array
When you pass an empty array to find we know we shoudl return an empty array but it is surprising that we are returning the original empty array instead of a new one.
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r--activerecord/test/cases/finder_test.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index e73c88dd5d..355fb4517f 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -371,7 +371,10 @@ class FinderTest < ActiveRecord::TestCase
end
def test_find_an_empty_array
- assert_equal [], Topic.find([])
+ empty_array = []
+ result = Topic.find(empty_array)
+ assert_equal [], result
+ assert_not_same empty_array, result
end
def test_find_doesnt_have_implicit_ordering