From 9eddf205efdf7e7274eff3ce0e1d3ab9b96fd108 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 29 May 2024 19:12:17 -0700 Subject: [PATCH] Fixed CI for Mongoid 9 --- test/callbacks_test.rb | 12 +++++----- test/index_cache_test.rb | 8 +++---- test/index_options_test.rb | 24 +++++++++---------- test/index_test.rb | 26 ++++++++++---------- test/inheritance_test.rb | 4 ++-- test/match_test.rb | 4 ++-- test/multi_indices_test.rb | 10 ++++---- test/notifications_test.rb | 2 +- test/order_test.rb | 2 +- test/pagination_test.rb | 4 ++-- test/partial_reindex_test.rb | 8 +++---- test/reindex_test.rb | 46 ++++++++++++++++++------------------ test/reindex_v2_job_test.rb | 6 ++--- test/relation_test.rb | 2 +- test/routing_test.rb | 2 +- test/search_synonyms_test.rb | 6 ++--- test/search_test.rb | 2 +- test/should_index_test.rb | 6 ++--- test/support/helpers.rb | 2 +- test/unscope_test.rb | 2 +- 20 files changed, 89 insertions(+), 89 deletions(-) diff --git a/test/callbacks_test.rb b/test/callbacks_test.rb index 195ceb76..4a14eb92 100644 --- a/test/callbacks_test.rb +++ b/test/callbacks_test.rb @@ -12,7 +12,7 @@ def test_bulk Searchkick.callbacks(:bulk) do store_names ["Product A", "Product B"] end - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A", "Product B"] end @@ -20,20 +20,20 @@ def test_queue # TODO figure out which earlier test leaves records in index Product.reindex - reindex_queue = Product.search_index.reindex_queue + reindex_queue = Product.searchkick_index.reindex_queue reindex_queue.clear Searchkick.callbacks(:queue) do store_names ["Product A", "Product B"] end - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", [], load: false, conversions: false assert_equal 2, reindex_queue.length perform_enqueued_jobs do Searchkick::ProcessQueueJob.perform_now(class_name: "Product") end - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A", "Product B"], load: false assert_equal 0, reindex_queue.length @@ -41,14 +41,14 @@ def test_queue Product.where(name: "Product B").destroy_all Product.create!(name: "Product C") end - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A", "Product B"], load: false assert_equal 2, reindex_queue.length perform_enqueued_jobs do Searchkick::ProcessQueueJob.perform_now(class_name: "Product") end - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A", "Product C"], load: false assert_equal 0, reindex_queue.length diff --git a/test/index_cache_test.rb b/test/index_cache_test.rb index 42aed2ee..c0a3659f 100644 --- a/test/index_cache_test.rb +++ b/test/index_cache_test.rb @@ -6,16 +6,16 @@ def setup end def test_default - object_id = Product.search_index.object_id + object_id = Product.searchkick_index.object_id 3.times do - assert_equal object_id, Product.search_index.object_id + assert_equal object_id, Product.searchkick_index.object_id end end def test_max_size starting_ids = object_ids(20) assert_equal starting_ids, object_ids(20) - Product.search_index(name: "other") + Product.searchkick_index(name: "other") refute_equal starting_ids, object_ids(20) end @@ -34,7 +34,7 @@ def test_thread_safe_max_size private def object_ids(count) - count.times.map { |i| Product.search_index(name: "index#{i}").object_id } + count.times.map { |i| Product.searchkick_index(name: "index#{i}").object_id } end def with_threads diff --git a/test/index_options_test.rb b/test/index_options_test.rb index ab9039db..5df8ec3b 100644 --- a/test/index_options_test.rb +++ b/test/index_options_test.rb @@ -24,8 +24,8 @@ def test_no_stem_exclusion store_names ["animals", "anime"] assert_search "animals", ["animals", "anime"], {misspellings: false} assert_search "anime", ["animals", "anime"], {misspellings: false} - assert_equal ["anim"], Song.search_index.tokens("anime", analyzer: "searchkick_index") - assert_equal ["anim"], Song.search_index.tokens("anime", analyzer: "searchkick_search2") + assert_equal ["anim"], Song.searchkick_index.tokens("anime", analyzer: "searchkick_index") + assert_equal ["anim"], Song.searchkick_index.tokens("anime", analyzer: "searchkick_search2") end end @@ -34,8 +34,8 @@ def test_stem_exclusion store_names ["animals", "anime"] assert_search "animals", ["animals"], {misspellings: false} assert_search "anime", ["anime"], {misspellings: false} - assert_equal ["anime"], Song.search_index.tokens("anime", analyzer: "searchkick_index") - assert_equal ["anime"], Song.search_index.tokens("anime", analyzer: "searchkick_search2") + assert_equal ["anime"], Song.searchkick_index.tokens("anime", analyzer: "searchkick_index") + assert_equal ["anime"], Song.searchkick_index.tokens("anime", analyzer: "searchkick_search2") end end @@ -44,8 +44,8 @@ def test_no_stemmer_override store_names ["animals", "animations"] assert_search "animals", ["animals", "animations"], {misspellings: false} assert_search "animations", ["animals", "animations"], {misspellings: false} - assert_equal ["anim"], Song.search_index.tokens("animations", analyzer: "searchkick_index") - assert_equal ["anim"], Song.search_index.tokens("animations", analyzer: "searchkick_search2") + assert_equal ["anim"], Song.searchkick_index.tokens("animations", analyzer: "searchkick_index") + assert_equal ["anim"], Song.searchkick_index.tokens("animations", analyzer: "searchkick_search2") end end @@ -54,8 +54,8 @@ def test_stemmer_override store_names ["animals", "animations"] assert_search "animals", ["animals"], {misspellings: false} assert_search "animations", ["animations"], {misspellings: false} - assert_equal ["animat"], Song.search_index.tokens("animations", analyzer: "searchkick_index") - assert_equal ["animat"], Song.search_index.tokens("animations", analyzer: "searchkick_search2") + assert_equal ["animat"], Song.searchkick_index.tokens("animations", analyzer: "searchkick_index") + assert_equal ["animat"], Song.searchkick_index.tokens("animations", analyzer: "searchkick_search2") end end @@ -68,25 +68,25 @@ def test_special_characters def test_index_name with_options({index_name: "songs_v2"}) do - assert_equal "songs_v2", Song.search_index.name + assert_equal "songs_v2", Song.searchkick_index.name end end def test_index_name_callable with_options({index_name: -> { "songs_v2" }}) do - assert_equal "songs_v2", Song.search_index.name + assert_equal "songs_v2", Song.searchkick_index.name end end def test_index_prefix with_options({index_prefix: "hello"}) do - assert_equal "hello_songs_test", Song.search_index.name + assert_equal "hello_songs_test", Song.searchkick_index.name end end def test_index_prefix_callable with_options({index_prefix: -> { "hello" }}) do - assert_equal "hello_songs_test", Song.search_index.name + assert_equal "hello_songs_test", Song.searchkick_index.name end end diff --git a/test/index_test.rb b/test/index_test.rb index 16ad0e96..fd12dad9 100644 --- a/test/index_test.rb +++ b/test/index_test.rb @@ -7,16 +7,16 @@ def setup end def test_tokens - assert_equal ["dollar", "dollartre", "tree"], Product.search_index.tokens("Dollar Tree", analyzer: "searchkick_index") + assert_equal ["dollar", "dollartre", "tree"], Product.searchkick_index.tokens("Dollar Tree", analyzer: "searchkick_index") end def test_tokens_analyzer - assert_equal ["dollar", "tree"], Product.search_index.tokens("Dollar Tree", analyzer: "searchkick_search2") + assert_equal ["dollar", "tree"], Product.searchkick_index.tokens("Dollar Tree", analyzer: "searchkick_search2") end def test_total_docs store_names ["Product A"] - assert_equal 1, Product.search_index.total_docs + assert_equal 1, Product.searchkick_index.total_docs end def test_clean_indices @@ -31,9 +31,9 @@ def test_clean_indices old_index.create different_index.create - Product.search_index.clean_indices + Product.searchkick_index.clean_indices - assert Product.search_index.exists? + assert Product.searchkick_index.exists? assert different_index.exists? assert !old_index.exists? end @@ -43,33 +43,33 @@ def test_clean_indices_old_format old_index = Searchkick::Index.new("products_test#{suffix}_20130801000000") old_index.create - Product.search_index.clean_indices + Product.searchkick_index.clean_indices assert !old_index.exists? end def test_retain Product.reindex - assert_equal 1, Product.search_index.all_indices.size + assert_equal 1, Product.searchkick_index.all_indices.size Product.reindex(retain: true) - assert_equal 2, Product.search_index.all_indices.size + assert_equal 2, Product.searchkick_index.all_indices.size end def test_mappings store_names ["Dollar Tree"], Store assert_equal ["Dollar Tree"], Store.search(body: {query: {match: {name: "dollar"}}}).map(&:name) - mapping = Store.search_index.mapping + mapping = Store.searchkick_index.mapping assert_kind_of Hash, mapping assert_equal "text", mapping.values.first["mappings"]["properties"]["name"]["type"] end def test_settings - assert_kind_of Hash, Store.search_index.settings + assert_kind_of Hash, Store.searchkick_index.settings end def test_remove_blank_id store_names ["Product A"] - Product.search_index.remove(Product.new) + Product.searchkick_index.remove(Product.new) assert_search "product", ["Product A"] ensure Product.reindex @@ -78,13 +78,13 @@ def test_remove_blank_id # keep simple for now, but maybe return client response in future def test_store_response product = Searchkick.callbacks(false) { Product.create!(name: "Product A") } - assert_nil Product.search_index.store(product) + assert_nil Product.searchkick_index.store(product) end # keep simple for now, but maybe return client response in future def test_bulk_index_response product = Searchkick.callbacks(false) { Product.create!(name: "Product A") } - assert_nil Product.search_index.bulk_index([product]) + assert_nil Product.searchkick_index.bulk_index([product]) end # TODO move diff --git a/test/inheritance_test.rb b/test/inheritance_test.rb index 4cec78ce..38e8803c 100644 --- a/test/inheritance_test.rb +++ b/test/inheritance_test.rb @@ -13,7 +13,7 @@ def test_child_reindex end def test_child_index_name - assert_equal "animals_test#{ENV["TEST_ENV_NUMBER"]}", Dog.search_index.name + assert_equal "animals_test#{ENV["TEST_ENV_NUMBER"]}", Dog.searchkick_index.name end def test_child_search @@ -133,7 +133,7 @@ def test_index_name_model def test_index_name_string store_names ["Product A"] error = assert_raises Searchkick::Error do - Searchkick.search("product", index_name: [Product.search_index.name]).map(&:name) + Searchkick.search("product", index_name: [Product.searchkick_index.name]).map(&:name) end assert_includes error.message, "Unknown model" end diff --git a/test/match_test.rb b/test/match_test.rb index df47a78e..614b7ce3 100644 --- a/test/match_test.rb +++ b/test/match_test.rb @@ -59,8 +59,8 @@ def test_stemming end def test_stemming_tokens - assert_equal ["milk"], Product.search_index.tokens("milks", analyzer: "searchkick_search") - assert_equal ["milk"], Product.search_index.tokens("milks", analyzer: "searchkick_search2") + assert_equal ["milk"], Product.searchkick_index.tokens("milks", analyzer: "searchkick_search") + assert_equal ["milk"], Product.searchkick_index.tokens("milks", analyzer: "searchkick_search2") end # fuzzy diff --git a/test/multi_indices_test.rb b/test/multi_indices_test.rb index cbae734f..3e2e8119 100644 --- a/test/multi_indices_test.rb +++ b/test/multi_indices_test.rb @@ -14,19 +14,19 @@ def test_basic def test_index_name store_names ["Product A"] - assert_equal ["Product A"], Product.search("product", index_name: Product.search_index.name).map(&:name) + assert_equal ["Product A"], Product.search("product", index_name: Product.searchkick_index.name).map(&:name) assert_equal ["Product A"], Product.search("product", index_name: Product).map(&:name) - Speaker.search_index.refresh - assert_equal [], Product.search("product", index_name: Speaker.search_index.name, conversions: false).map(&:name) + Speaker.searchkick_index.refresh + assert_equal [], Product.search("product", index_name: Speaker.searchkick_index.name, conversions: false).map(&:name) end def test_models_and_index_name store_names ["Product A"] store_names ["Product B"], Speaker - assert_equal ["Product A"], Searchkick.search("product", models: [Product, Store], index_name: Product.search_index.name).map(&:name) + assert_equal ["Product A"], Searchkick.search("product", models: [Product, Store], index_name: Product.searchkick_index.name).map(&:name) error = assert_raises(Searchkick::Error) do - Searchkick.search("product", models: [Product, Store], index_name: Speaker.search_index.name).map(&:name) + Searchkick.search("product", models: [Product, Store], index_name: Speaker.searchkick_index.name).map(&:name) end assert_includes error.message, "Unknown model" # legacy diff --git a/test/notifications_test.rb b/test/notifications_test.rb index 6098dab7..ed2a91ca 100644 --- a/test/notifications_test.rb +++ b/test/notifications_test.rb @@ -2,7 +2,7 @@ class NotificationsTest < Minitest::Test def test_search - Product.search_index.refresh + Product.searchkick_index.refresh notifications = capture_notifications do Product.search("product").to_a diff --git a/test/order_test.rb b/test/order_test.rb index a270cbc4..5155f472 100644 --- a/test/order_test.rb +++ b/test/order_test.rb @@ -27,7 +27,7 @@ def test_multiple end def test_unmapped_type - Product.search_index.refresh + Product.searchkick_index.refresh assert_order "product", [], order: {not_mapped: {unmapped_type: "long"}} assert_order_relation [], Product.search("product").order(not_mapped: {unmapped_type: "long"}) end diff --git a/test/pagination_test.rb b/test/pagination_test.rb index 81eabd0f..0ed0150f 100644 --- a/test/pagination_test.rb +++ b/test/pagination_test.rb @@ -185,10 +185,10 @@ def test_pit pit_id = if Searchkick.opensearch? - path = "#{CGI.escape(Product.search_index.name)}/_search/point_in_time" + path = "#{CGI.escape(Product.searchkick_index.name)}/_search/point_in_time" Searchkick.client.transport.perform_request("POST", path, {keep_alive: "5s"}).body["pit_id"] else - Searchkick.client.open_point_in_time(index: Product.search_index.name, keep_alive: "5s")["id"] + Searchkick.client.open_point_in_time(index: Product.searchkick_index.name, keep_alive: "5s")["id"] end store_names ["Product C", "Product F"] diff --git a/test/partial_reindex_test.rb b/test/partial_reindex_test.rb index 635e6101..65f69999 100644 --- a/test/partial_reindex_test.rb +++ b/test/partial_reindex_test.rb @@ -15,7 +15,7 @@ def test_relation_inline Searchkick.callbacks(false) do product.save! end - Product.search_index.refresh + Product.searchkick_index.refresh # index not updated assert_search "hi", ["Hi"], fields: [:name], load: false @@ -43,7 +43,7 @@ def test_record_inline Searchkick.callbacks(false) do product.save! end - Product.search_index.refresh + Product.searchkick_index.refresh # index not updated assert_search "hi", ["Hi"], fields: [:name], load: false @@ -65,7 +65,7 @@ def test_relation_missing store [{name: "Hi", color: "Blue"}] product = Product.first - Product.search_index.remove(product) + Product.searchkick_index.remove(product) error = assert_raises(Searchkick::ImportError) do Product.reindex(:search_name) @@ -77,7 +77,7 @@ def test_record_missing store [{name: "Hi", color: "Blue"}] product = Product.first - Product.search_index.remove(product) + Product.searchkick_index.remove(product) error = assert_raises(Searchkick::ImportError) do product.reindex(:search_name) diff --git a/test/reindex_test.rb b/test/reindex_test.rb index 896c4af8..f65e2c4d 100644 --- a/test/reindex_test.rb +++ b/test/reindex_test.rb @@ -14,7 +14,7 @@ def test_record_destroyed product = Product.find_by!(name: "Product A") product.destroy - Product.search_index.refresh + Product.searchkick_index.refresh assert_equal true, product.reindex end @@ -25,25 +25,25 @@ def test_record_async perform_enqueued_jobs do assert_equal true, product.reindex(mode: :async) end - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A"] end def test_record_queue - reindex_queue = Product.search_index.reindex_queue + reindex_queue = Product.searchkick_index.reindex_queue reindex_queue.clear store_names ["Product A", "Product B"], reindex: false product = Product.find_by!(name: "Product A") assert_equal true, product.reindex(mode: :queue) - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", [] perform_enqueued_jobs do Searchkick::ProcessQueueJob.perform_now(class_name: "Product") end - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A"] end @@ -51,7 +51,7 @@ def test_record_index store_names ["Product A", "Product B"], reindex: false product = Product.find_by!(name: "Product A") - assert_equal true, Product.search_index.reindex([product], refresh: true) + assert_equal true, Product.searchkick_index.reindex([product], refresh: true) assert_search "product", ["Product A"] end @@ -106,7 +106,7 @@ def test_relation_should_index Product.find_by(name: "Product B").update!(name: "DO NOT INDEX") end assert_equal true, Product.where(name: "DO NOT INDEX").reindex - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A"] end @@ -116,7 +116,7 @@ def test_relation_async perform_enqueued_jobs do Product.where(name: "Product B").reindex(mode: :async) end - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A", "Product B"] end @@ -128,7 +128,7 @@ def test_relation_async_should_index perform_enqueued_jobs do assert_equal true, Product.where(name: "DO NOT INDEX").reindex(mode: :async) end - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A"] end @@ -137,48 +137,48 @@ def test_relation_async_routing perform_enqueued_jobs do Store.where(name: "Store A").reindex(mode: :async) end - Store.search_index.refresh + Store.searchkick_index.refresh assert_search "*", ["Store A"], {routing: "Store A"}, Store end def test_relation_queue - reindex_queue = Product.search_index.reindex_queue + reindex_queue = Product.searchkick_index.reindex_queue reindex_queue.clear store_names ["Product A"] store_names ["Product B", "Product C"], reindex: false Product.where(name: "Product B").reindex(mode: :queue) - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A"] perform_enqueued_jobs do Searchkick::ProcessQueueJob.perform_now(class_name: "Product") end - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "product", ["Product A", "Product B"] end def test_relation_queue_routing - reindex_queue = Store.search_index.reindex_queue + reindex_queue = Store.searchkick_index.reindex_queue reindex_queue.clear store_names ["Store A"], Store, reindex: false Store.where(name: "Store A").reindex(mode: :queue) - Store.search_index.refresh + Store.searchkick_index.refresh assert_search "*", [], {}, Store perform_enqueued_jobs do Searchkick::ProcessQueueJob.perform_now(class_name: "Store") end - Store.search_index.refresh + Store.searchkick_index.refresh assert_search "*", ["Store A"], {routing: "Store A"}, Store end def test_relation_index store_names ["Product A"] store_names ["Product B", "Product C"], reindex: false - Product.search_index.reindex(Product.where(name: "Product B"), refresh: true) + Product.searchkick_index.reindex(Product.where(name: "Product B"), refresh: true) assert_search "product", ["Product A", "Product B"] end @@ -198,7 +198,7 @@ def test_full_async assert_equal true, reindex_status[:completed] assert_equal 0, reindex_status[:batches_left] - Product.search_index.promote(reindex[:index_name]) + Product.searchkick_index.promote(reindex[:index_name]) assert_search "product", ["Product A"] end @@ -246,12 +246,12 @@ def test_full_async_non_integer_pk def test_full_refresh_interval reindex = Product.reindex(refresh_interval: "30s", mode: :async, import: false) index = Searchkick::Index.new(reindex[:index_name]) - assert_nil Product.search_index.refresh_interval + assert_nil Product.searchkick_index.refresh_interval assert_equal "30s", index.refresh_interval - Product.search_index.promote(index.name, update_refresh_interval: true) + Product.searchkick_index.promote(index.name, update_refresh_interval: true) assert_equal "1s", index.refresh_interval - assert_equal "1s", Product.search_index.refresh_interval + assert_equal "1s", Product.searchkick_index.refresh_interval end def test_full_resume @@ -284,7 +284,7 @@ def test_wait_not_async def test_object_index error = assert_raises(Searchkick::Error) do - Product.search_index.reindex(Object.new) + Product.searchkick_index.reindex(Object.new) end assert_equal "Cannot reindex object", error.message end @@ -300,7 +300,7 @@ def test_transaction end def test_both_paths - Product.search_index.delete if Product.search_index.exists? + Product.searchkick_index.delete if Product.searchkick_index.exists? Product.reindex Product.reindex # run twice for both index paths end diff --git a/test/reindex_v2_job_test.rb b/test/reindex_v2_job_test.rb index 5da27d76..d934444c 100644 --- a/test/reindex_v2_job_test.rb +++ b/test/reindex_v2_job_test.rb @@ -3,10 +3,10 @@ class ReindexV2JobTest < Minitest::Test def test_create product = Searchkick.callbacks(false) { Product.create!(name: "Boom") } - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "*", [] Searchkick::ReindexV2Job.perform_now("Product", product.id.to_s) - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "*", ["Boom"] end @@ -16,7 +16,7 @@ def test_destroy assert_search "*", ["Boom"] Searchkick.callbacks(false) { product.destroy } Searchkick::ReindexV2Job.perform_now("Product", product.id.to_s) - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "*", [] end end diff --git a/test/relation_test.rb b/test/relation_test.rb index 7898f030..44f61256 100644 --- a/test/relation_test.rb +++ b/test/relation_test.rb @@ -2,7 +2,7 @@ class RelationTest < Minitest::Test def test_loaded - Product.search_index.refresh + Product.searchkick_index.refresh products = Product.search("*") refute products.loaded? assert_equal 0, products.count diff --git a/test/routing_test.rb b/test/routing_test.rb index a739db7e..49255b92 100644 --- a/test/routing_test.rb +++ b/test/routing_test.rb @@ -7,7 +7,7 @@ def test_query end def test_mappings - mappings = Store.search_index.index_options[:mappings] + mappings = Store.searchkick_index.index_options[:mappings] assert_equal mappings[:_routing], required: true end diff --git a/test/search_synonyms_test.rb b/test/search_synonyms_test.rb index 465a4a45..1c4d9750 100644 --- a/test/search_synonyms_test.rb +++ b/test/search_synonyms_test.rb @@ -67,11 +67,11 @@ def test_multiple_words_expanded def test_reload_synonyms if Searchkick.server_below?("7.3.0") error = assert_raises(Searchkick::Error) do - Speaker.search_index.reload_synonyms + Speaker.searchkick_index.reload_synonyms end assert_equal "Requires Elasticsearch 7.3+", error.message else - Speaker.search_index.reload_synonyms + Speaker.searchkick_index.reload_synonyms end end @@ -87,7 +87,7 @@ def test_reload_synonyms_better write_synonyms("test,goodbye") assert_search "test", ["Hello"] - Speaker.search_index.reload_synonyms + Speaker.searchkick_index.reload_synonyms assert_search "test", ["Goodbye"] end ensure diff --git a/test/search_test.rb b/test/search_test.rb index af1f2b20..4dcdc3c7 100644 --- a/test/search_test.rb +++ b/test/search_test.rb @@ -44,7 +44,7 @@ def test_missing_records end def test_bad_mapping - Product.search_index.delete + Product.searchkick_index.delete store_names ["Product A"] error = assert_raises(Searchkick::InvalidQueryError) { Product.search("test").to_a } assert_equal "Bad mapping - run Product.reindex", error.message diff --git a/test/should_index_test.rb b/test/should_index_test.rb index 2211f7e4..c3531c24 100644 --- a/test/should_index_test.rb +++ b/test/should_index_test.rb @@ -16,7 +16,7 @@ def test_change_to_true product = Product.first product.name = "INDEX" product.save! - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "index", ["INDEX"] end @@ -26,7 +26,7 @@ def test_change_to_false product = Product.first product.name = "DO NOT INDEX" product.save! - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "index", [] end @@ -38,7 +38,7 @@ def test_bulk product.save! end Product.where(id: product.id).reindex - Product.search_index.refresh + Product.searchkick_index.refresh assert_search "index", [] end end diff --git a/test/support/helpers.rb b/test/support/helpers.rb index 67c7e57a..c0a0f898 100644 --- a/test/support/helpers.rb +++ b/test/support/helpers.rb @@ -115,7 +115,7 @@ def with_callbacks(value, &block) end def with_transaction(model, &block) - if model.respond_to?(:transaction) + if model.respond_to?(:transaction) && !mongoid? model.transaction(&block) else yield diff --git a/test/unscope_test.rb b/test/unscope_test.rb index e3a9521b..01caa80e 100644 --- a/test/unscope_test.rb +++ b/test/unscope_test.rb @@ -22,7 +22,7 @@ def test_relation_async Artist.unscoped.reindex(mode: :async) end - Artist.search_index.refresh + Artist.searchkick_index.refresh assert_search "*", ["Test", "Test 2"] end