test/reindex_test.rb in searchkick-3.0.2 vs test/reindex_test.rb in searchkick-3.0.3
- old
+ new
@@ -26,11 +26,11 @@
store.products.reindex(refresh: true)
assert_search "product", ["Product A", "Product B"]
end
def test_async
- skip if !defined?(ActiveJob)
+ skip unless defined?(ActiveJob)
Searchkick.callbacks(false) do
store_names ["Product A"]
end
reindex = Product.reindex(async: true)
@@ -38,15 +38,33 @@
index = Searchkick::Index.new(reindex[:index_name])
index.refresh
assert_equal 1, index.total_docs
+ if defined?(Redis)
+ assert Searchkick.reindex_status(reindex[:name])
+ end
+
Product.searchkick_index.promote(reindex[:index_name])
assert_search "product", ["Product A"]
end
+ def test_async_wait
+ skip unless defined?(ActiveJob) && defined?(Redis)
+
+ Searchkick.callbacks(false) do
+ store_names ["Product A"]
+ end
+
+ capture_io do
+ Product.reindex(async: {wait: true})
+ end
+
+ assert_search "product", ["Product A"]
+ end
+
def test_async_non_integer_pk
- skip if !defined?(ActiveJob)
+ skip unless defined?(ActiveJob)
Sku.create(id: SecureRandom.hex, name: "Test")
reindex = Sku.reindex(async: true)
assert_search "sku", [], conversions: false