test/match_test.rb in searchkick-1.2.1 vs test/match_test.rb in searchkick-1.3.0
- old
+ new
@@ -108,24 +108,27 @@
store_names ["Ziploc"]
assert_search "zip lock", ["Ziploc"]
end
def test_misspelling_zucchini_transposition
+ skip if elasticsearch_below14?
store_names ["zucchini"]
assert_search "zuccihni", ["zucchini"]
assert_search "zuccihni", [], misspellings: {transpositions: false}
end
def test_misspelling_lasagna
+ skip if elasticsearch_below14?
store_names ["lasagna"]
assert_search "lasanga", ["lasagna"], misspellings: {transpositions: true}
assert_search "lasgana", ["lasagna"], misspellings: {transpositions: true}
assert_search "lasaang", [], misspellings: {transpositions: true} # triple transposition, shouldn't work
assert_search "lsagana", [], misspellings: {transpositions: true} # triple transposition, shouldn't work
end
def test_misspelling_lasagna_pasta
+ skip if elasticsearch_below14?
store_names ["lasagna pasta"]
assert_search "lasanga", ["lasagna pasta"], misspellings: {transpositions: true}
assert_search "lasanga pasta", ["lasagna pasta"], misspellings: {transpositions: true}
assert_search "lasanga pasat", ["lasagna pasta"], misspellings: {transpositions: true} # both words misspelled with a transposition should still work
end
@@ -187,9 +190,14 @@
end
def test_ampersand_search
store_names ["Ben and Jerry's"]
assert_search "ben & jerrys", ["Ben and Jerry's"]
+ end
+
+ def test_phrase
+ store_names ["Fresh Honey", "Honey Fresh"]
+ assert_search "fresh honey", ["Fresh Honey"], match: :phrase
end
def test_unsearchable
store [
{name: "Unsearchable", description: "Almond"}