Commit 7ca77ccbd760c010af67c526a465da7d939f1121
Committed by
GitHub
1 parent
d854c11c
Exists in
master
and in
5 other branches
Use `Searchkick::Results` as class for `model_name` when searching across multiple models (#1492)
Showing
2 changed files
with
17 additions
and
1 deletions
Show diff stats
lib/searchkick/results.rb
test/results_test.rb
... | ... | @@ -14,4 +14,16 @@ class ResultsTest < Minitest::Test |
14 | 14 | end |
15 | 15 | assert_equal 2, count |
16 | 16 | end |
17 | + | |
18 | + def test_model_name_with_klass | |
19 | + store_names ["Product A", "Product B"] | |
20 | + results = Product.search("product") | |
21 | + assert_equal "Product", results.model_name.human | |
22 | + end | |
23 | + | |
24 | + def test_model_name_without_klass | |
25 | + store_names ["Product A", "Product B"] | |
26 | + results = Searchkick.search("product") | |
27 | + assert_equal "Result", results.model_name.human | |
28 | + end | |
17 | 29 | end | ... | ... |