diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-31 17:15:56 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-31 17:15:56 +0000 |
commit | 8158455ded5811271e7d8530f262bc74a1677334 (patch) | |
tree | abeffb1a90c1d9aa5e086166ef9aa4893f4418a9 /activerecord/test | |
parent | 0cf79f07b0be7bb9912dfe2a9f2f4c45d98ac41e (diff) | |
download | rails-8158455ded5811271e7d8530f262bc74a1677334.tar.gz rails-8158455ded5811271e7d8530f262bc74a1677334.tar.bz2 rails-8158455ded5811271e7d8530f262bc74a1677334.zip |
Fix an edge case with find with a list of ids, limit, and offset. Closes #8437.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6912 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/finder_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb index de7d1b4318..38838cab83 100644 --- a/activerecord/test/finder_test.rb +++ b/activerecord/test/finder_test.rb @@ -44,6 +44,13 @@ class FinderTest < Test::Unit::TestCase def test_find_by_ids_with_limit_and_offset assert_equal 2, Entrant.find([1,3,2], :limit => 2).size assert_equal 1, Entrant.find([1,3,2], :limit => 3, :offset => 2).size + + # Also test an edge case: If you have 11 results, and you set a + # limit of 3 and offset of 9, then you should find that there + # will be only 2 results, regardless of the limit. + devs = Developer.find :all + last_devs = Developer.find devs.map(&:id), :limit => 3, :offset => 9 + assert_equal 2, last_devs.size end def test_find_an_empty_array |