To edit pages or tickets please login with username/password: aaf/aaf

Changeset 163

Show
Ignore:
Timestamp:
03/14/07 16:58:04 (2 years ago)
Author:
jk
Message:

limit and sorting test

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/demo/test/unit/content_test.rb

    r160 r163  
    213213  end 
    214214 
     215  def test_sort_with_limit 
     216    sorting = [ Ferret::Search::SortField.new(:id, :type => :string, :reverse => true) ] 
     217    result = Content.find_by_contents('comment_count:2 OR comment_count:1', :sort => sorting) 
     218    assert result.size > 2 
     219    result = Content.find_by_contents('comment_count:2 OR comment_count:1', :sort => sorting, :limit => 2) 
     220    assert_equal 2, result.size 
     221    assert result.first.id > result.last.id 
     222  end 
     223   
    215224  def test_multi_index 
    216225    i =  ActsAsFerret::MultiIndex.new([Content, Comment]) 

To edit pages or tickets please login with username/password: aaf/aaf