aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorYasuo Honda <yasuo.honda@gmail.com>2019-01-30 12:17:58 +0000
committerYasuo Honda <yasuo.honda@gmail.com>2019-02-08 00:33:16 +0000
commit95c4101fbe9800217bcacd107fa058e197e28d97 (patch)
treed95b8ef94924ca8651b68be7ad7ef8c1a206ac86 /activerecord
parentb2d8036df7427dca67d1cbe1e3c3e0fd7b33bf56 (diff)
downloadrails-95c4101fbe9800217bcacd107fa058e197e28d97.tar.gz
rails-95c4101fbe9800217bcacd107fa058e197e28d97.tar.bz2
rails-95c4101fbe9800217bcacd107fa058e197e28d97.zip
Address `test_belongs_to_does_not_use_order_by` failure due to checking order by for metadata queries
Also, `test_has_one_does_not_use_order_by` should not check metadata queries. Fixes #35098
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb3
-rw-r--r--activerecord/test/cases/associations/has_one_associations_test.rb4
2 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb
index a61569420e..c01138c059 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -63,7 +63,8 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
ActiveRecord::SQLCounter.clear_log
Client.find(3).firm
ensure
- assert ActiveRecord::SQLCounter.log_all.all? { |sql| /order by/i !~ sql }, "ORDER BY was used in the query"
+ sql_log = ActiveRecord::SQLCounter.log
+ assert sql_log.all? { |sql| /order by/i !~ sql }, "ORDER BY was used in the query: #{sql_log}"
end
def test_belongs_to_with_primary_key
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb
index 3e5b5c1275..7bb629466d 100644
--- a/activerecord/test/cases/associations/has_one_associations_test.rb
+++ b/activerecord/test/cases/associations/has_one_associations_test.rb
@@ -37,8 +37,8 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
ActiveRecord::SQLCounter.clear_log
companies(:first_firm).account
ensure
- log_all = ActiveRecord::SQLCounter.log_all
- assert log_all.all? { |sql| /order by/i !~ sql }, "ORDER BY was used in the query: #{log_all}"
+ sql_log = ActiveRecord::SQLCounter.log
+ assert sql_log.all? { |sql| /order by/i !~ sql }, "ORDER BY was used in the query: #{sql_log}"
end
def test_has_one_cache_nils