aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
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/associations
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/associations')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index 594d161fa3..b865002f03 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -240,7 +240,7 @@ class EagerAssociationTest < ActiveRecord::TestCase
end
def test_load_associated_records_in_one_query_when_adapter_has_no_limit
- assert_called(Comment.connection, :in_clause_length, returns: nil) do
+ assert_not_called(Comment.connection, :in_clause_length) do
post = posts(:welcome)
assert_queries(2) do
Post.includes(:comments).where(id: post.id).to_a
@@ -249,16 +249,16 @@ class EagerAssociationTest < ActiveRecord::TestCase
end
def test_load_associated_records_in_several_queries_when_many_ids_passed
- assert_called(Comment.connection, :in_clause_length, returns: 1) do
+ assert_called(Comment.connection, :in_clause_length, times: 2, returns: 1) do
post1, post2 = posts(:welcome), posts(:thinking)
- assert_queries(3) do
+ assert_queries(2) do
Post.includes(:comments).where(id: [post1.id, post2.id]).to_a
end
end
end
def test_load_associated_records_in_one_query_when_a_few_ids_passed
- assert_called(Comment.connection, :in_clause_length, returns: 3) do
+ assert_not_called(Comment.connection, :in_clause_length) do
post = posts(:welcome)
assert_queries(2) do
Post.includes(:comments).where(id: post.id).to_a