Commit 29959a24bac1a929635b49c5b4d41b79cb0f65a2
1 parent
79fd1cab
Exists in
master
and in
2 other branches
Added reindex relation tests [skip ci]
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
test/reindex_test.rb
@@ -75,10 +75,32 @@ class ReindexTest < Minitest::Test | @@ -75,10 +75,32 @@ class ReindexTest < Minitest::Test | ||
75 | 75 | ||
76 | def test_relation_async | 76 | def test_relation_async |
77 | skip "Not available yet" | 77 | skip "Not available yet" |
78 | + | ||
79 | + store_names ["Product A"] | ||
80 | + store_names ["Product B", "Product C"], reindex: false | ||
81 | + Product.where(name: "Product B").reindex(mode: :async) | ||
82 | + Product.search_index.refresh | ||
83 | + assert_search "product", ["Product A", "Product B"] | ||
78 | end | 84 | end |
79 | 85 | ||
80 | def test_relation_queue | 86 | def test_relation_queue |
81 | skip "Not available yet" | 87 | skip "Not available yet" |
88 | + | ||
89 | + skip unless defined?(ActiveJob) && defined?(Redis) | ||
90 | + | ||
91 | + reindex_queue = Product.searchkick_index.reindex_queue | ||
92 | + reindex_queue.clear | ||
93 | + | ||
94 | + store_names ["Product A"] | ||
95 | + store_names ["Product B", "Product C"], reindex: false | ||
96 | + | ||
97 | + Product.where(name: "Product B").reindex(mode: :queue) | ||
98 | + Product.search_index.refresh | ||
99 | + assert_search "product", [] | ||
100 | + | ||
101 | + Searchkick::ProcessQueueJob.perform_now(class_name: "Product") | ||
102 | + Product.search_index.refresh | ||
103 | + assert_search "product", ["Product A", "Product B"] | ||
82 | end | 104 | end |
83 | 105 | ||
84 | def test_full_async | 106 | def test_full_async |