spec/api/query/ordering_pagination_examples.rb in sunspot-2.0.0.pre.120925 vs spec/api/query/ordering_pagination_examples.rb in sunspot-2.0.0.pre.130115
- old
+ new
@@ -66,9 +66,30 @@
order_by :random
end
connection.searches.last[:sort].should =~ /^random_\d+ asc$/
end
+ it 'orders by random with declared direction' do
+ search do
+ order_by :random, :desc
+ end
+ connection.searches.last[:sort].should =~ /^random_\d+ desc$/
+ end
+
+ it 'orders by random with provided seed value' do
+ search do
+ order_by :random, :seed => 9001
+ end
+ connection.searches.last[:sort].should =~ /^random_9001 asc$/
+ end
+
+ it 'orders by random with provided seed value and direction' do
+ search do
+ order_by :random, :seed => 12345, :direction => :desc
+ end
+ connection.searches.last[:sort].should =~ /^random_12345 desc$/
+ end
+
it 'orders by score' do
search do
order_by :score, :desc
end
connection.should have_last_search_with(:sort => 'score desc')