Skip to content

Commit

Permalink
remove deprecated #first calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jonleighton committed Apr 26, 2012
1 parent 759d302 commit 5866321
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 28 deletions.
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
14 changes: 0 additions & 14 deletions activerecord/test/cases/named_scope_test.rb
Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/relation_scoping_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 5866321

Please sign in to comment.