@@ -53,25 +53,24 @@ class OffsetAndLimitTestSqlserver < ActiveRecord::TestCase
5353 should 'add locks to deepest sub select' do
5454 pattern = /FROM \[ books\] \s +WITH \( NOLOCK\) /
5555 assert_sql ( pattern ) { Book . limit ( 3 ) . lock ( 'WITH (NOLOCK)' ) . offset ( 5 ) . load }
56- assert_sql ( pattern ) { Book . count :limit => 3 , :offset => 5 , :lock => 'WITH (NOLOCK)' }
5756 end
5857
5958 should 'have valid sort order' do
60- order_row_numbers = SqlServerOrderRowNumber . offset ( 7 ) . order ( "c DESC" ) . select ( "c, ROW_NUMBER() OVER (ORDER BY c ASC) AS [dummy]" ) . all . map ( &:c )
59+ order_row_numbers = SqlServerOrderRowNumber . offset ( 7 ) . order ( "c DESC" ) . select ( "c, ROW_NUMBER() OVER (ORDER BY c ASC) AS [dummy]" ) . load . map ( &:c )
6160 assert_equal [ 2 , 1 , 0 ] , order_row_numbers
6261 end
6362
6463 should 'work with through associations' do
65- assert_equal people ( :david ) , jobs ( :unicyclist ) . people . limit ( 1 ) . offset ( 1 ) . all . first
64+ assert_equal people ( :david ) , jobs ( :unicyclist ) . people . limit ( 1 ) . offset ( 1 ) . first
6665 end
6766
6867 should 'work with through uniq associations' do
6968 david = authors ( :david )
7069 mary = authors ( :mary )
7170 thinking = posts ( :thinking )
7271 # Mary has duplicate categorizations to the thinking post.
73- assert_equal [ thinking , thinking ] , mary . categorized_posts . all
74- assert_equal [ thinking ] , mary . unique_categorized_posts . limit ( 2 ) . offset ( 0 )
72+ assert_equal [ thinking , thinking ] , mary . categorized_posts . load
73+ assert_equal [ thinking ] , mary . unique_categorized_posts . limit ( 2 ) . offset ( 0 ) . load
7574 # Paging thru David's uniq ordered comments, with count too.
7675 assert_equal [ 1 , 2 , 3 , 5 , 6 , 7 , 8 , 9 , 10 , 12 ] , david . ordered_uniq_comments . map ( &:id )
7776 assert_equal [ 3 , 5 ] , david . ordered_uniq_comments . limit ( 2 ) . offset ( 2 ) . map ( &:id )
@@ -83,7 +82,7 @@ class OffsetAndLimitTestSqlserver < ActiveRecord::TestCase
8382 should 'remove [__rnt] table names from relation reflection and hence do not eager loading' do
8483 create_10_books
8584 create_10_books
86- assert_queries ( 1 ) { Book . limit ( 10 ) . offset ( 10 ) . includes ( :subscriptions ) . all }
85+ assert_queries ( 1 ) { Book . includes ( :subscriptions ) . limit ( 10 ) . offset ( 10 ) . references ( :subscriptions ) . load }
8786 end
8887
8988
0 commit comments