diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-09-19 14:31:12 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-09-19 14:32:18 -0400 |
commit | e184d1a94e3ecfbc22823fbb9097992158a40cb2 (patch) | |
tree | 141065394a633772edfd13dbecd11bab5eba1261 /activerecord/test | |
parent | 1b90f614b1b3d06b7f02a8b9ea6cd84f15d58643 (diff) | |
download | rails-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')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 5 |
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 |