test/suggest_test.rb in searchkick-2.3.0 vs test/suggest_test.rb in searchkick-2.3.1
- old
+ new
@@ -65,9 +65,19 @@
def test_fields_partial_match_boost
store_names ["Great White Shark", "Hammerhead Shark", "Tiger Shark"]
assert_suggest "How Big is a Tigre Shar", "how big is a tiger shark", fields: [{"name^2" => :word_start}]
end
+ def test_multiple_models
+ store_names ["Great White Shark", "Hammerhead Shark", "Tiger Shark"]
+ assert_equal "how big is a tiger shark", Searchkick.search("How Big is a Tigre Shar", suggest: [:name]).suggestions.first
+ end
+
+ def test_multiple_models_no_fields
+ store_names ["Great White Shark", "Hammerhead Shark", "Tiger Shark"]
+ assert_raises(ArgumentError) { Searchkick.search("How Big is a Tigre Shar", suggest: true) }
+ end
+
protected
def assert_suggest(term, expected, options = {})
result = Product.search(term, options.merge(suggest: true)).suggestions.first
if expected.nil?