test/reindex_test.rb in searchkick-2.0.2 vs test/reindex_test.rb in searchkick-2.0.3

- old
+ new

@@ -20,6 +20,23 @@ store = Store.create!(name: "Test") Product.create!(name: "Product B", store_id: store.id) store.products.reindex(refresh: true) assert_search "product", ["Product A", "Product B"] end + + def test_async + skip unless defined?(ActiveJob) && defined?(ActiveRecord) + + Searchkick.callbacks(false) do + store_names ["Product A"] + end + reindex = Product.reindex(async: true) + assert_search "product", [] + + index = Searchkick::Index.new(reindex[:index_name]) + index.refresh + assert_equal 1, index.total_docs + + Product.searchkick_index.promote(reindex[:index_name]) + assert_search "product", ["Product A"] + end end