Skip to content

Commit f58963b

Browse files
authored
Rename assert_queries test (#1158)
1 parent dea7899 commit f58963b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

test/cases/coerced_tests.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_partial_index_coerced
5656

5757
t = Topic.create!(title: "abc")
5858
t.author_name = "John"
59-
assert_queries(1) do
59+
assert_queries_count(1) do
6060
t.valid?
6161
end
6262
end
@@ -234,7 +234,7 @@ def test_update_date_time_attributes_with_default_timezone_local
234234
coerce_tests! %r{an empty transaction does not raise if preventing writes}
235235
test "an empty transaction does not raise if preventing writes coerced" do
236236
ActiveRecord::Base.while_preventing_writes do
237-
assert_queries(1, ignore_none: true) do
237+
assert_queries_count(1, ignore_none: true) do
238238
Bird.transaction do
239239
ActiveRecord::Base.lease_connection.materialize_transactions
240240
end
@@ -490,8 +490,8 @@ def test_limit_with_offset_is_kept_coerced
490490
coerce_tests! :test_distinct_count_all_with_custom_select_and_order
491491
def test_distinct_count_all_with_custom_select_and_order_coerced
492492
accounts = Account.distinct.select("credit_limit % 10 AS the_limit").order(Arel.sql("credit_limit % 10"))
493-
assert_queries(1) { assert_equal 3, accounts.count(:all) }
494-
assert_queries(1) { assert_equal 3, accounts.load.size }
493+
assert_queries_count(1) { assert_equal 3, accounts.count(:all) }
494+
assert_queries_count(1) { assert_equal 3, accounts.load.size }
495495
end
496496

497497
# Leave it up to users to format selects/functions so HAVING works correctly.
@@ -1324,7 +1324,7 @@ def test_create_without_primary_key_no_extra_query_coerced
13241324
self.table_name = "dashboards"
13251325
end
13261326
klass.create! # warmup schema cache
1327-
assert_queries(2, ignore_none: true) { klass.create! }
1327+
assert_queries_count(2, ignore_none: true) { klass.create! }
13281328
end
13291329
end
13301330

@@ -1354,7 +1354,7 @@ def test_query_cached_even_when_types_are_reset_coerced
13541354
Task.initialize_find_by_cache
13551355
Task.define_attribute_methods
13561356

1357-
assert_queries(1, ignore_none: true) do
1357+
assert_queries_count(1, ignore_none: true) do
13581358
Task.find(1)
13591359
end
13601360

@@ -1454,11 +1454,11 @@ def test_relations_dont_load_all_records_in_pretty_print_coerced
14541454
def test_empty_complex_chained_relations_coerced
14551455
posts = Post.select("comments_count").where("id is not null").group("author_id", "id").where("legacy_comments_count > 0")
14561456

1457-
assert_queries(1) { assert_equal false, posts.empty? }
1457+
assert_queries_count(1) { assert_equal false, posts.empty? }
14581458
assert_not_predicate posts, :loaded?
14591459

14601460
no_posts = posts.where(title: "")
1461-
assert_queries(1) { assert_equal true, no_posts.empty? }
1461+
assert_queries_count(1) { assert_equal true, no_posts.empty? }
14621462
assert_not_predicate no_posts, :loaded?
14631463
end
14641464

@@ -2377,7 +2377,7 @@ class BasePreventWritesTest < ActiveRecord::TestCase
23772377
coerce_tests! %r{an empty transaction does not raise if preventing writes}
23782378
test "an empty transaction does not raise if preventing writes coerced" do
23792379
ActiveRecord::Base.while_preventing_writes do
2380-
assert_queries(1, ignore_none: true) do
2380+
assert_queries_count(1, ignore_none: true) do
23812381
Bird.transaction do
23822382
ActiveRecord::Base.lease_connection.materialize_transactions
23832383
end

test/cases/eager_load_too_many_ids_test_sqlserver.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_batch_preloading_too_many_ids
1111
# We Monkey patch Preloader to work with batches of 10_000 records.
1212
# Expect: N Books queries + Citation query
1313
expected_query_count = (Citation.count / in_clause_length.to_f).ceil + 1
14-
assert_queries(expected_query_count) do
14+
assert_queries_count(expected_query_count) do
1515
Citation.preload(:reference_of).to_a.size
1616
end
1717
end

0 commit comments

Comments
 (0)