test/suggest_test.rb in searchkick-1.4.2 vs test/suggest_test.rb in searchkick-1.5.0
- old
+ new
@@ -68,10 +68,15 @@
end
protected
def assert_suggest(term, expected, options = {})
- assert_equal expected, Product.search(term, options.merge(suggest: true)).suggestions.first
+ result = Product.search(term, options.merge(suggest: true)).suggestions.first
+ if expected.nil?
+ assert_nil result
+ else
+ assert_equal expected, result
+ end
end
# any order
def assert_suggest_all(term, expected, options = {})
assert_equal expected.sort, Product.search(term, options.merge(suggest: true)).suggestions.sort