Commit 6fc6638bb6699ad1bd25423f3e810692cbad8d46

Authored by Andrew Kane
1 parent d257d4c4

Added async test for relation should_index? [skip ci]

Showing 1 changed file with 10 additions and 0 deletions   Show diff stats
test/reindex_test.rb
... ... @@ -79,6 +79,16 @@ class ReindexTest < Minitest::Test
79 79 assert_search "product", ["Product A", "Product B"]
80 80 end
81 81  
  82 + def test_relation_async_should_index
  83 + store_names ["Product A", "Product B"]
  84 + Searchkick.callbacks(false) do
  85 + Product.find_by(name: "Product B").update!(name: "DO NOT INDEX")
  86 + end
  87 + assert_equal true, Product.where(name: "DO NOT INDEX").reindex(mode: :async)
  88 + Product.search_index.refresh
  89 + assert_search "product", ["Product A"]
  90 + end
  91 +
82 92 def test_relation_queue
83 93 reindex_queue = Product.searchkick_index.reindex_queue
84 94 reindex_queue.clear
... ...