test/match_test.rb in searchkick-0.9.1 vs test/match_test.rb in searchkick-1.0.0

- old
+ new

@@ -1,11 +1,8 @@ -# encoding: utf-8 - require_relative "test_helper" -class TestMatch < Minitest::Test - +class MatchTest < Minitest::Test # exact def test_match store_names ["Whole Milk", "Fat Free Milk", "Milk"] assert_search "milk", ["Milk", "Whole Milk", "Fat Free Milk"] @@ -112,12 +109,12 @@ assert_search "zip lock", ["Ziploc"] end def test_misspelling_zucchini_transposition store_names ["zucchini"] - assert_search "zuccihni", [] # doesn't work without transpositions:true option - assert_search "zuccihni", ["zucchini"], misspellings: {transpositions: true} + assert_search "zuccihni", ["zucchini"] + assert_search "zuccihni", [], misspellings: {transpositions: false} end def test_misspelling_lasagna store_names ["lasagna"] assert_search "lasanga", ["lasagna"], misspellings: {transpositions: true} @@ -131,10 +128,15 @@ 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 + def test_misspellings_word_start + store_names ["Sriracha"] + assert_search "siracha", ["Sriracha"], fields: [{name: :word_start}] + end + # spaces def test_spaces_in_field store_names ["Red Bull"] assert_search "redbull", ["Red Bull"] @@ -193,7 +195,6 @@ store [ {name: "Unsearchable", description: "Almond"} ] assert_search "almond", [] end - end