Skip to content

Commit

Permalink
remove deprecated #find_in_batches calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jonleighton committed Apr 26, 2012
1 parent bd91f70 commit f6ddb13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
Expand Up @@ -465,7 +465,7 @@ def test_find_each_with_conditions
firm = companies(:first_firm)

assert_queries(2) do
firm.clients.find_each(:batch_size => 1, :conditions => {:name => "Microsoft"}) do |c|
firm.clients.where(name: 'Microsoft').find_each(batch_size: 1) do |c|
assert_equal firm.id, c.firm_id
assert_equal "Microsoft", c.name
end
Expand Down
16 changes: 2 additions & 14 deletions activerecord/test/cases/batches_test.rb
Expand Up @@ -27,30 +27,18 @@ def test_each_should_not_return_query_chain_and_execcute_only_one_query

def test_each_should_raise_if_select_is_set_without_id
assert_raise(RuntimeError) do
Post.find_each(:select => :title, :batch_size => 1) { |post| post }
Post.select(:title).find_each(:batch_size => 1) { |post| post }
end
end

def test_each_should_execute_if_id_is_in_select
assert_queries(6) do
Post.find_each(:select => "id, title, type", :batch_size => 2) do |post|
Post.select("id, title, type").find_each(:batch_size => 2) do |post|
assert_kind_of Post, post
end
end
end

def test_each_should_raise_if_the_order_is_set
assert_raise(RuntimeError) do
Post.find_each(:order => "title") { |post| post }
end
end

def test_each_should_raise_if_the_limit_is_set
assert_raise(RuntimeError) do
Post.find_each(:limit => 1) { |post| post }
end
end

def test_warn_if_limit_scope_is_set
ActiveRecord::Base.logger.expects(:warn)
Post.limit(1).find_each { |post| post }
Expand Down

0 comments on commit f6ddb13

Please sign in to comment.