Skip to content

Commit 043b0f1

Browse files
author
Anna
committed
updating deprecated AR syntax
1 parent d2cc375 commit 043b0f1

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

test/cases/eager_test_sqlserver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class EagerAssociationTest < ActiveRecord::TestCase
1515
fixtures :posts, :comments, :authors
1616

1717
def test_coerced_count_with_include
18-
assert_equal 3, authors(:david).posts_with_comments.count(:conditions => "len(comments.body) > 15")
18+
assert_equal 3, authors(:david).posts_with_comments.where("len(comments.body) > 15").count
1919
end
2020

2121

test/cases/offset_and_limit_test_sqlserver.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

test/cases/schema_dumper_test_sqlserver.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ class SchemaDumperTestSqlserver < ActiveRecord::TestCase
1010
should 'honor nonstandards' do
1111
table_dump('movies') do |output|
1212
match = output.match(%r{create_table "movies"(.*)do})
13-
assert_not_nil(match, "nonstandardpk table not found")
14-
puts "**#{output}"
13+
assert_not_nil(match, "nonstandardpk table not found")
1514
assert_match %r(primary_key: "movieid"), match[1], "non-standard primary key not preserved"
1615
end
1716
end

0 commit comments

Comments
 (0)