FEATURE: order:latest support for search

This commit is contained in:
Sam
2014-09-03 22:10:18 +10:00
parent 3a76dd3463
commit 28ae3c8ad0
2 changed files with 28 additions and 8 deletions

View File

@@ -321,6 +321,16 @@ describe Search do
Search.execute('test status:closed').posts.length.should == 1
Search.execute('test status:open').posts.length.should == 0
end
it 'can find by latest' do
topic1 = Fabricate(:topic, title: 'I do not like that Sam I am')
post1 = Fabricate(:post, topic: topic1)
post2 = Fabricate(:post, raw: 'that Sam I am, that Sam I am')
Search.execute('sam').posts.map(&:id).should == [post1.id, post2.id]
Search.execute('sam order:latest').posts.map(&:id).should == [post2.id, post1.id]
end
end