aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorAlexander Balashov <divineforest@gmail.com>2013-03-28 16:03:02 +0400
committerAlexander Balashov <divineforest@gmail.com>2014-01-21 17:27:34 +0400
commit691709dd6741757e5c4459c8942857ee019b68a0 (patch)
tree72a5f1e23bea676973d37cbbb3d4d97b435e6dd6 /activerecord/test/cases
parentb8302bcfdaec2a9e7658262d6feeb535c572922d (diff)
downloadrails-691709dd6741757e5c4459c8942857ee019b68a0.tar.gz
rails-691709dd6741757e5c4459c8942857ee019b68a0.tar.bz2
rails-691709dd6741757e5c4459c8942857ee019b68a0.zip
Fail early with "Primary key not included in the custom select clause" in find_in_batches
Before this patch find_in_batches raises this error only on second iteration. So you will know about the problem only when you get the batch size threshold.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/batches_test.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/test/cases/batches_test.rb b/activerecord/test/cases/batches_test.rb
index 38c2560d69..ebb36e4940 100644
--- a/activerecord/test/cases/batches_test.rb
+++ b/activerecord/test/cases/batches_test.rb
@@ -46,7 +46,9 @@ class EachTest < ActiveRecord::TestCase
def test_each_should_raise_if_select_is_set_without_id
assert_raise(RuntimeError) do
- Post.select(:title).find_each(:batch_size => 1) { |post| post }
+ Post.select(:title).find_each(batch_size: 1) { |post|
+ flunk "should not call this block"
+ }
end
end