aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-11-08 21:39:13 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-11-08 21:39:13 +0000
commit97f418ce022da6b5da9cf24779932820e947414d (patch)
tree06ecd0c098ffdcedc9ad45ff3930e24178c74970 /activerecord/test
parent86aaa6e9886ec16a76618e819092d0748bbedd53 (diff)
downloadrails-97f418ce022da6b5da9cf24779932820e947414d.tar.gz
rails-97f418ce022da6b5da9cf24779932820e947414d.tar.bz2
rails-97f418ce022da6b5da9cf24779932820e947414d.zip
Correct handling of complex order clauses with SQL Server limit emulation. Closes #2770.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2943 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/finder_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb
index dc3464727e..897657faeb 100644
--- a/activerecord/test/finder_test.rb
+++ b/activerecord/test/finder_test.rb
@@ -325,6 +325,16 @@ class FinderTest < Test::Unit::TestCase
assert_equal 'fixture_9', last_two_developers.first.name
end
+ def test_find_all_with_limit_and_offset_and_multiple_order_clauses
+ first_three_posts = Post.find :all, :order => 'author_id, id', :limit => 3, :offset => 0
+ second_three_posts = Post.find :all, :order => ' author_id,id ', :limit => 3, :offset => 3
+ last_posts = Post.find :all, :order => ' author_id, id ', :limit => 3, :offset => 6
+
+ assert_equal [[0,3],[1,1],[1,2]], first_three_posts.map { |p| [p.author_id, p.id] }
+ assert_equal [[1,4],[1,5],[1,6]], second_three_posts.map { |p| [p.author_id, p.id] }
+ assert_equal [[2,7]], last_posts.map { |p| [p.author_id, p.id] }
+ end
+
def test_find_all_with_join
developers_on_project_one = Developer.find(
:all,