Commit 72d6ff771daabeead370aa38fd0deadf3ba17310

Authored by Andrew Kane
1 parent 7b4227e2

Fixed tests for Elasticsearch 8 [skip ci]

Showing 1 changed file with 10 additions and 2 deletions   Show diff stats
test/misspellings_test.rb
@@ -13,13 +13,21 @@ class MisspellingsTest < Minitest::Test @@ -13,13 +13,21 @@ class MisspellingsTest < Minitest::Test
13 13
14 def test_prefix_length 14 def test_prefix_length
15 store_names ["ap", "api", "apt", "any", "nap", "ah", "ahi"] 15 store_names ["ap", "api", "apt", "any", "nap", "ah", "ahi"]
16 - assert_search "ap", ["ap"], misspellings: {prefix_length: 2} 16 + if Searchkick.server_below?("8.0.0")
  17 + assert_search "ap", ["ap"], misspellings: {prefix_length: 2}
  18 + else
  19 + assert_search "ap", ["ap", "api", "apt"], misspellings: {prefix_length: 2}
  20 + end
17 assert_search "api", ["ap", "api", "apt"], misspellings: {prefix_length: 2} 21 assert_search "api", ["ap", "api", "apt"], misspellings: {prefix_length: 2}
18 end 22 end
19 23
20 def test_prefix_length_operator 24 def test_prefix_length_operator
21 store_names ["ap", "api", "apt", "any", "nap", "ah", "aha"] 25 store_names ["ap", "api", "apt", "any", "nap", "ah", "aha"]
22 - assert_search "ap ah", ["ap", "ah"], operator: "or", misspellings: {prefix_length: 2} 26 + if Searchkick.server_below?("8.0.0")
  27 + assert_search "ap ah", ["ap", "ah"], operator: "or", misspellings: {prefix_length: 2}
  28 + else
  29 + assert_search "ap ah", ["ap", "ah", "api", "apt", "aha"], operator: "or", misspellings: {prefix_length: 2}
  30 + end
23 assert_search "api ahi", ["ap", "api", "apt", "ah", "aha"], operator: "or", misspellings: {prefix_length: 2} 31 assert_search "api ahi", ["ap", "api", "apt", "ah", "aha"], operator: "or", misspellings: {prefix_length: 2}
24 end 32 end
25 33