Skip to content

Commit c3ead9f

Browse files
committed
[Rails5] Coerce EachTest for in batches.
1 parent 7334e44 commit c3ead9f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/cases/coerced_tests.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def test_with_abstract_class_scope_should_be_executed_in_correct_context_coerced
270270
require 'models/post'
271271
require 'models/subscriber'
272272
class EachTest < ActiveRecord::TestCase
273+
# Quoting in tests does not cope with bracket quoting.
273274
coerce_tests! :test_find_in_batches_should_quote_batch_order
274275
def test_find_in_batches_should_quote_batch_order_coerced
275276
c = Post.connection
@@ -280,6 +281,18 @@ def test_find_in_batches_should_quote_batch_order_coerced
280281
end
281282
end
282283
end
284+
285+
# Quoting in tests does not cope with bracket quoting.
286+
coerce_tests! :test_in_batches_should_quote_batch_order
287+
def test_in_batches_should_quote_batch_order_coerced
288+
c = Post.connection
289+
assert_sql(/ORDER BY \[posts\]\.\[id\]/) do
290+
Post.in_batches(of: 1) do |relation|
291+
assert_kind_of ActiveRecord::Relation, relation
292+
assert_kind_of Post, relation.first
293+
end
294+
end
295+
end
283296
end
284297

285298

0 commit comments

Comments
 (0)