Commit 9fb6ba9bc7900c873d573539c9a7b691a102184b
1 parent
b7bc140b
Exists in
master
and in
21 other branches
Updated facet tests
Showing
1 changed file
with
8 additions
and
2 deletions
Show diff stats
test/facets_test.rb
... | ... | @@ -2,15 +2,21 @@ require_relative "test_helper" |
2 | 2 | |
3 | 3 | class TestFacets < Minitest::Unit::TestCase |
4 | 4 | |
5 | - def test_facets | |
5 | + def setup | |
6 | + super | |
6 | 7 | store [ |
7 | 8 | {name: "Product Show", store_id: 1, in_stock: true, color: "blue"}, |
8 | 9 | {name: "Product Hide", store_id: 2, in_stock: false, color: "green"}, |
9 | 10 | {name: "Product B", store_id: 2, in_stock: false, color: "red"} |
10 | 11 | ] |
12 | + end | |
13 | + | |
14 | + def test_basic | |
11 | 15 | assert_equal 2, Product.search("Product", facets: [:store_id]).facets["store_id"]["terms"].size |
16 | + end | |
17 | + | |
18 | + def test_where | |
12 | 19 | assert_equal 1, Product.search("Product", facets: {store_id: {where: {in_stock: true}}}).facets["store_id"]["terms"].size |
13 | - assert_equal 1, Product.search("Product", facets: {store_id: {where: {in_stock: true, color: "blue"}}}).facets["store_id"]["terms"].size | |
14 | 20 | end |
15 | 21 | |
16 | 22 | end | ... | ... |