Skip to content

Commit 72de6cf

Browse files
committed
Update order_test_sqlserver.rb
1 parent 911ea0c commit 72de6cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/cases/order_test_sqlserver.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,13 @@ class OrderTestSQLServer < ActiveRecord::TestCase
252252
end
253253

254254
it "in the subquery the first projection is used for ordering if none provided" do
255-
sql = "SELECT sum(legacy_comments_count), count(*), min(legacy_comments_count) FROM (SELECT [posts].[legacy_comments_count], [posts].[tags_count] FROM [posts] ORDER BY [posts].[legacy_comments_count] ASC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY) subquery ORDER BY sum(legacy_comments_count) ASC OFFSET 0 ROWS FETCH NEXT @1 ROWS ONLY"
255+
sql = "SELECT sum(legacy_comments_count), count(*), min(legacy_comments_count) FROM (SELECT [posts].[legacy_comments_count], [posts].[tags_count] FROM [posts] ORDER BY [posts].[id] ASC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY) subquery ORDER BY sum(legacy_comments_count) ASC OFFSET 0 ROWS FETCH NEXT @1 ROWS ONLY"
256256

257257
# $DEBUG = true
258258

259259
assert_queries_match(/#{Regexp.escape(sql)}/) do
260260
result = Post.from(Post.limit(5).select(:legacy_comments_count, :tags_count)).pick(Arel.sql("sum(legacy_comments_count), count(*), min(legacy_comments_count)"))
261-
assert_equal result, [0, 5, 0]
261+
assert_equal result, [10, 5, 0]
262262
end
263263
end
264264

0 commit comments

Comments
 (0)