Skip to content

Commit 15ddce9

Browse files
committed
Exercise test for the order should apply before count
1 parent 83dad7f commit 15ddce9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

activerecord/test/cases/calculations_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,13 @@ def test_should_limit_calculation_with_offset
255255
assert_equal [2, 6], c.keys.compact
256256
end
257257

258+
def test_order_should_apply_before_count
259+
accounts = Account.order(id: :desc).limit(4)
260+
261+
assert_equal 4, accounts.count(:firm_id)
262+
assert_equal 4, accounts.select(:firm_id).count
263+
end
264+
258265
def test_limit_should_apply_before_count
259266
accounts = Account.order(:id).limit(4)
260267

0 commit comments

Comments
 (0)