diff options
author | Brian Christian <brchristian@gmail.com> | 2016-02-27 11:03:46 -0800 |
---|---|---|
committer | Brian Christian <brchristian@gmail.com> | 2016-02-27 11:10:19 -0800 |
commit | d4d1fe53a191cc9440eed91058d62c606b405e6c (patch) | |
tree | 54ee6168bf92c447578810c683d6c411719db9d6 /activerecord/test | |
parent | 761dc68d5708fe05eb5fc31ad7f2debdd321f4dd (diff) | |
download | rails-d4d1fe53a191cc9440eed91058d62c606b405e6c.tar.gz rails-d4d1fe53a191cc9440eed91058d62c606b405e6c.tar.bz2 rails-d4d1fe53a191cc9440eed91058d62c606b405e6c.zip |
adding additional tests for offset and limit behavior
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 8be833b3b2..083efd1851 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -491,6 +491,9 @@ class FinderTest < ActiveRecord::TestCase # test with offset assert_equal topics(:fourth), Topic.offset(1).second_to_last + assert_equal topics(:fourth), Topic.offset(2).second_to_last + assert_equal topics(:fourth), Topic.offset(3).second_to_last + assert_equal nil, Topic.offset(4).second_to_last assert_equal nil, Topic.offset(5).second_to_last #test with limit @@ -517,11 +520,16 @@ class FinderTest < ActiveRecord::TestCase # test with offset assert_equal topics(:third), Topic.offset(1).third_to_last + assert_equal topics(:third), Topic.offset(2).third_to_last + assert_equal nil, Topic.offset(3).third_to_last + assert_equal nil, Topic.offset(4).third_to_last assert_equal nil, Topic.offset(5).third_to_last # test with limit assert_equal nil, Topic.limit(1).third assert_equal nil, Topic.limit(1).third_to_last + assert_equal nil, Topic.limit(2).third + assert_equal nil, Topic.limit(2).third_to_last end def test_third_to_last_have_primary_key_order_by_default |