Sha256: e8dfa1513acf6ba9b9ba89e30081ed4c66de1e4e6abb15375c67d7512403f4da

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

require_relative "test_helper"

class MultiSearchTest < Minitest::Test
  def test_basic
    store_names ["Product A"]
    store_names ["Store A"], Store
    products = Product.search("*", execute: false)
    stores = Store.search("*", execute: false)
    Searchkick.multi_search([products, stores])
    assert_equal ["Product A"], products.map(&:name)
    assert_equal ["Store A"], stores.map(&:name)
  end

  def test_error
    store_names ["Product A"]
    products = Product.search("*", execute: false)
    stores = Store.search("*", order: [:bad_field], execute: false)
    Searchkick.multi_search([products, stores])
    assert !products.error
    assert stores.error
  end

  def test_misspellings_below_unmet
    store_names ["abc", "abd", "aee"]
    products = Product.search("abc", misspellings: {below: 2}, execute: false)
    Searchkick.multi_search([products])
    assert_equal ["abc"], products.map(&:name)
  end

  def test_misspellings_below_unmet_retry
    store_names ["abc", "abd", "aee"]
    products = Product.search("abc", misspellings: {below: 2}, execute: false)
    Searchkick.multi_search([products], retry_misspellings: true)
    assert_equal ["abc", "abd"], products.map(&:name)
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
searchkick-hooopo-2.4.1 test/multi_search_test.rb
searchkick-hooopo-2.4.0 test/multi_search_test.rb
searchkick-2.4.0 test/multi_search_test.rb
searchkick-hooopo-2.3.5 test/multi_search_test.rb
searchkick-2.3.2 test/multi_search_test.rb
searchkick-hooopo-2.3.4 test/multi_search_test.rb