spec/integration/faceting_spec.rb in sunspot-2.0.0.pre.111215 vs spec/integration/faceting_spec.rb in sunspot-2.0.0.pre.120415
- old
+ new
@@ -82,10 +82,17 @@
with :blog_id, 1
facet :title, :zeros => true
end
search.facet(:title).rows.map { |row| row.value }.should include('zero')
end
+
+ it 'should return facet rows from an offset' do
+ search = Sunspot.search(Post) do
+ facet :title, :offset => 3
+ end
+ search.facet(:title).rows.map { |row| row.value }.should == %w(one zero)
+ end
it 'should return a specified minimum count' do
search = Sunspot.search(Post) do
with :blog_id, 1
facet :title, :minimum_count => 2
@@ -131,9 +138,22 @@
with :blog_id, 1
facet :title, :extra => :none
end
search.facet(:title).rows.first.value.should == :none
search.facet(:title).rows.first.count.should == 1
+ end
+
+ it 'gives correct facet count when group == true and truncate == true' do
+ search = Sunspot.search(Post) do
+ group :title do
+ truncate
+ end
+
+ facet :title, :extra => :any
+ end
+
+ # Should be 5 instead of 11
+ search.facet(:title).rows.first.count.should == 5
end
end
context 'multiselect faceting' do
before do