Skip to content
Browse files

remove deprecated #first calls

  • Loading branch information...
1 parent 759d302 commit 58663218e8025c0d7ab691228fc278bc35e092a7 @jonleighton jonleighton committed Apr 26, 2012
View
13 activerecord/test/cases/associations/has_many_associations_test.rb
@@ -805,7 +805,7 @@ def test_deleting_before_save
end
def test_deleting_updates_counter_cache
- topic = Topic.first(:order => "id ASC")
+ topic = Topic.order("id ASC").first
assert_equal topic.replies.to_a.size, topic.replies_count
topic.replies.delete(topic.replies.first)
@@ -1491,17 +1491,6 @@ def test_blank_custom_primary_key_on_new_record_should_not_run_queries
end
end
- def test_calling_first_or_last_with_find_options_on_loaded_association_should_fetch_with_query
- firm = companies(:first_firm)
- firm.clients.class # force load target
-
- assert_queries 2 do
- assert firm.clients.loaded?
- firm.clients.first(:order => 'name')
- firm.clients.last(:order => 'name')
- end
- end
-
def test_calling_first_or_last_with_integer_on_association_should_load_association
firm = companies(:first_firm)
View
14 activerecord/test/cases/named_scope_test.rb
@@ -146,11 +146,6 @@ def test_active_records_have_scope_named__scoped__
assert_equal scope, Topic.scoped(where: "content LIKE '%Have%'")
end
- def test_first_and_last_should_support_find_options
- assert_equal Topic.base.first(:order => 'title'), Topic.base.find(:first, :order => 'title')
- assert_equal Topic.base.last(:order => 'title'), Topic.base.find(:last, :order => 'title')
- end
-
def test_first_and_last_should_allow_integers_for_limit
assert_equal Topic.base.first(2), Topic.base.to_a.first(2)
assert_equal Topic.base.last(2), Topic.base.order("id").to_a.last(2)
@@ -165,15 +160,6 @@ def test_first_and_last_should_not_use_query_when_results_are_loaded
end
end
- def test_first_and_last_find_options_should_use_query_when_results_are_loaded
- topics = Topic.base
- topics.reload # force load
- assert_queries(2) do
- topics.first(:order => 'title')
- topics.last(:order => 'title')
- end
- end
-
def test_empty_should_not_load_results
topics = Topic.base
assert_queries(2) do
View
4 activerecord/test/cases/relation_scoping_test.rb
@@ -53,8 +53,8 @@ def test_scoped_find_last
end
def test_scoped_find_last_preserves_scope
- lowest_salary = Developer.first :order => "salary ASC"
- highest_salary = Developer.first :order => "salary DESC"
+ lowest_salary = Developer.order("salary ASC").first
+ highest_salary = Developer.order("salary DESC").first
Developer.order("salary").scoping do
assert_equal highest_salary, Developer.last

0 comments on commit 5866321

Please sign in to comment.
Something went wrong with that request. Please try again.