aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-04-24 06:30:59 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-04-24 13:35:42 +0900
commit5d858b5d3e5539ede0ea541a8e14126a3ee30800 (patch)
tree6902aaec7f9e8e6053949b94b96597bb16331005 /activerecord/test/cases/relation
parent2c0729d8cb13100ea576337ebb7703320203c548 (diff)
downloadrails-5d858b5d3e5539ede0ea541a8e14126a3ee30800.tar.gz
rails-5d858b5d3e5539ede0ea541a8e14126a3ee30800.tar.bz2
rails-5d858b5d3e5539ede0ea541a8e14126a3ee30800.zip
Fix sliced IN clauses to be grouped
Follow up of #35838. And also this refactors `in_clause_length` handling is entirely integrated in Arel visitor.
Diffstat (limited to 'activerecord/test/cases/relation')
-rw-r--r--activerecord/test/cases/relation/where_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb
index 2ecccfe1f3..6c1e3e7fec 100644
--- a/activerecord/test/cases/relation/where_test.rb
+++ b/activerecord/test/cases/relation/where_test.rb
@@ -20,6 +20,13 @@ module ActiveRecord
class WhereTest < ActiveRecord::TestCase
fixtures :posts, :edges, :authors, :author_addresses, :binaries, :essays, :cars, :treasures, :price_estimates, :topics
+ def test_in_clause_is_correctly_sliced
+ assert_called(Author.connection, :in_clause_length, returns: 1) do
+ david = authors(:david)
+ assert_equal [david], Author.where(name: "David", id: [1, 2])
+ end
+ end
+
def test_where_copies_bind_params
author = authors(:david)
posts = author.posts.where("posts.id != 1")