Commit 6fc6638bb6699ad1bd25423f3e810692cbad8d46
1 parent
d257d4c4
Exists in
master
and in
2 other branches
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,6 +79,16 @@ class ReindexTest < Minitest::Test | ||
79 | assert_search "product", ["Product A", "Product B"] | 79 | assert_search "product", ["Product A", "Product B"] |
80 | end | 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 | def test_relation_queue | 92 | def test_relation_queue |
83 | reindex_queue = Product.searchkick_index.reindex_queue | 93 | reindex_queue = Product.searchkick_index.reindex_queue |
84 | reindex_queue.clear | 94 | reindex_queue.clear |