test/finder_test.rb in will_paginate-2.3.16 vs test/finder_test.rb in will_paginate-2.3.17

- old
+ new

@@ -98,11 +98,11 @@ assert_equal expected, entries.to_a assert_equal 1, entries.total_pages end def test_paginate_with_conditions - entries = Topic.paginate :page => 1, :conditions => ["created_at > ?", 30.minutes.ago] + entries = Topic.paginate :page => 1, :conditions => ["created_at > ?", 30.minutes.ago], :order => :id expected = [topics(:rails), topics(:ar)] assert_equal expected, entries.to_a assert_equal 1, entries.total_pages end @@ -188,11 +188,11 @@ assert_equal expected.map(&:id).sort, topic.replies.paginate(:page => 1).map(&:id).sort assert_equal expected.reverse, topic.replies.paginate(:page => 1, :order => 'replies.id ASC') end def test_paginate_association_extension - project = Project.find(:first) + project = Project.find(:first, :order => :id) assert_queries(2) do entries = project.replies.paginate_recent :page => 1 assert_equal [replies(:brave)], entries end @@ -239,11 +239,11 @@ entries = Developer.paginate :conditions => { :salary => 100000 }, :page => 1, :per_page => 5 assert_equal 8, entries.total_entries assert_equal entries, Developer.paginate_by_salary(100000, :page => 1, :per_page => 5) # dynamic finder + conditions - entries = Developer.paginate_by_salary(100000, :page => 1, + entries = Developer.paginate_by_salary(100000, :page => 1, :order => :id, :conditions => ['id > ?', 6]) assert_equal 4, entries.total_entries assert_equal (7..10).to_a, entries.map(&:id) assert_raises NoMethodError do @@ -304,9 +304,16 @@ def test_named_scope_with_include project = projects(:active_record) entries = project.topics.with_replies_starting_with('AR ').paginate(:page => 1, :per_page => 1) assert_equal 1, entries.size + end + + def test_paginated_each_with_scoped_order + paginated_developers = [] + Developer.poor.paginated_each {|d| paginated_developers << d} + + assert_equal Developer.poor.find(:all), paginated_developers, 'should use scoped :order option' end ## misc ## def test_count_and_total_entries_options_are_mutually_exclusive