test/facets_test.rb in inquisitio-2.1.0 vs test/facets_test.rb in inquisitio-2.1.1
- old
+ new
@@ -66,7 +66,20 @@
facets = searcher.result_facets
assert_equal 12, facets[:genres][:buckets].first[:count]
assert_equal 2, facets[:rating][:buckets][1][:count]
end
+ def test_should_return_empty_if_no_facets_requested
+ body = {
+ 'status' => {'rid' => 'u9aP4eYo8gIK0csK', 'time-ms' => 4},
+ 'hits' => {'found' => 1, 'start' => 0, 'hit' => [{'data' => {'id' => ['20'], 'title' => ['Foobar2'], 'type' => ['Module_Dog']}}], }
+ }.to_json
+ Excon.stubs.clear
+ Excon.stub({}, {body: body, status: 200})
+
+ searcher = Searcher.where('star_wars')
+ facets = searcher.result_facets
+ assert_equal [], facets.fields
+ end
+
end
end