diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-12-03 12:07:38 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-12-03 12:07:38 -0800 |
commit | 9329f28c6df6103e90f87aa2eae8cfb3bba88623 (patch) | |
tree | 132104ed203e1485a0fc7726be46692ff7e8f018 /activerecord/test/cases/finder_test.rb | |
parent | da633f81eb529e2a9f3a731ecdf205ecff186cf3 (diff) | |
parent | 2a517e7291d6f93b6ca3d8c56fc8559c48089c28 (diff) | |
download | rails-9329f28c6df6103e90f87aa2eae8cfb3bba88623.tar.gz rails-9329f28c6df6103e90f87aa2eae8cfb3bba88623.tar.bz2 rails-9329f28c6df6103e90f87aa2eae8cfb3bba88623.zip |
Merge pull request #13149 from laurocaetano/fix_offset_last
Fix offset with last.
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index e76c1a113a..b06418d9fe 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -720,6 +720,15 @@ class FinderTest < ActiveRecord::TestCase assert_raise(ArgumentError) { Topic.find_by_title_and_author_name("The First Topic") } end + def test_find_last_with_offset + devs = Developer.order('id').all + + assert_equal devs[2], Developer.offset(2).first + assert_equal devs[-3], Developer.offset(2).last + assert_equal devs[-3], Developer.offset(2).last + assert_equal devs[-3], Developer.offset(2).order('id DESC').first + end + def test_find_by_nil_attribute topic = Topic.find_by_last_read nil assert_not_nil topic |