Sha256: 464d2fce7ee126ba6eb6b52c8b7cfda5bfc835675224248ec53d77da8b16b3bb
Contents?: true
Size: 845 Bytes
Versions: 4
Compression:
Stored size: 845 Bytes
Contents
require_relative "test_helper" class TestFacets < Minitest::Unit::TestCase def setup super store [ {name: "Product Show", store_id: 1, in_stock: true, color: "blue"}, {name: "Product Hide", store_id: 2, in_stock: false, color: "green"}, {name: "Product B", store_id: 2, in_stock: false, color: "red"} ] end def test_basic assert_equal 2, Product.search("Product", facets: [:store_id]).facets["store_id"]["terms"].size end def test_where assert_equal 1, Product.search("Product", facets: {store_id: {where: {in_stock: true}}}).facets["store_id"]["terms"].size end def test_limit facet = Product.search("Product", facets: {store_id: {limit: 1}}).facets["store_id"] assert_equal 1, facet["terms"].size assert_equal 3, facet["total"] assert_equal 1, facet["other"] end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
searchkick-0.3.4 | test/facets_test.rb |
searchkick-0.3.3 | test/facets_test.rb |
searchkick-0.3.2 | test/facets_test.rb |
searchkick-0.3.1 | test/facets_test.rb |