From 0e0e81921fc7e105aaae172ddc8e675d847e72c0 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Mon, 21 Feb 2022 19:14:23 -0800 Subject: [PATCH] Fixed execute warnings in tests --- benchmark/search.rb | 2 +- test/multi_search_test.rb | 14 +++++++------- test/query_test.rb | 12 +++++------- test/routing_test.rb | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/benchmark/search.rb b/benchmark/search.rb index 820f831..a7fe9bb 100644 --- a/benchmark/search.rb +++ b/benchmark/search.rb @@ -45,7 +45,7 @@ if ENV["SETUP"] puts "Reindexed" end -query = Product.search("product", fields: [:name], where: {color: "red", store_id: 5}, limit: 10000, load: false, execute: false) +query = Product.search("product", fields: [:name], where: {color: "red", store_id: 5}, limit: 10000, load: false) require "pp" pp query.body.as_json diff --git a/test/multi_search_test.rb b/test/multi_search_test.rb index c98282b..96c4b02 100644 --- a/test/multi_search_test.rb +++ b/test/multi_search_test.rb @@ -4,8 +4,8 @@ class MultiSearchTest < Minitest::Test def test_basic store_names ["Product A"] store_names ["Store A"], Store - products = Product.search("*", execute: false) - stores = Store.search("*", execute: false) + products = Product.search("*") + stores = Store.search("*") Searchkick.multi_search([products, stores]) assert_equal ["Product A"], products.map(&:name) assert_equal ["Store A"], stores.map(&:name) @@ -13,14 +13,14 @@ class MultiSearchTest < Minitest::Test def test_methods result = Product.search("*") - query = Product.search("*", execute: false) + query = Product.search("*") assert_empty(result.methods - query.methods) end def test_error store_names ["Product A"] - products = Product.search("*", execute: false) - stores = Store.search("*", order: [:bad_field], execute: false) + products = Product.search("*") + stores = Store.search("*", order: [:bad_field]) Searchkick.multi_search([products, stores]) assert !products.error assert stores.error @@ -28,13 +28,13 @@ class MultiSearchTest < Minitest::Test def test_misspellings_below_unmet store_names ["abc", "abd", "aee"] - products = Product.search("abc", misspellings: {below: 5}, execute: false) + products = Product.search("abc", misspellings: {below: 5}) Searchkick.multi_search([products]) assert_equal ["abc", "abd"], products.map(&:name) end def test_query_error - products = Product.search("*", order: {bad_column: :asc}, execute: false) + products = Product.search("*", order: {bad_column: :asc}) Searchkick.multi_search([products]) assert products.error error = assert_raises(Searchkick::Error) { products.results } diff --git a/test/query_test.rb b/test/query_test.rb index e0658d0..8eadfdd 100644 --- a/test/query_test.rb +++ b/test/query_test.rb @@ -3,10 +3,8 @@ require_relative "test_helper" class QueryTest < Minitest::Test def test_basic store_names ["Milk", "Apple"] - query = Product.search("milk", execute: false) - query.body[:query] = {match_all: {}} + query = Product.search("milk", body: {query: {match_all: {}}}) assert_equal ["Apple", "Milk"], query.map(&:name).sort - assert_equal ["Apple", "Milk"], query.execute.map(&:name).sort end def test_with_uneffective_min_score @@ -15,15 +13,15 @@ class QueryTest < Minitest::Test end def test_default_timeout - assert_equal "6s", Product.search("*", execute: false).body[:timeout] + assert_equal "6s", Product.search("*").body[:timeout] end def test_timeout_override - assert_equal "1s", Product.search("*", body_options: {timeout: "1s"}, execute: false).body[:timeout] + assert_equal "1s", Product.search("*", body_options: {timeout: "1s"}).body[:timeout] end def test_request_params - assert_equal "dfs_query_then_fetch", Product.search("*", request_params: {search_type: "dfs_query_then_fetch"}, execute: false).params[:search_type] + assert_equal "dfs_query_then_fetch", Product.search("*", request_params: {search_type: "dfs_query_then_fetch"}).params[:search_type] end def test_debug @@ -44,7 +42,7 @@ class QueryTest < Minitest::Test # body_options def test_body_options_should_merge_into_body - query = Product.search("*", body_options: {min_score: 1.0}, execute: false) + query = Product.search("*", body_options: {min_score: 1.0}) assert_equal 1.0, query.body[:min_score] end diff --git a/test/routing_test.rb b/test/routing_test.rb index 49faba5..49255b9 100644 --- a/test/routing_test.rb +++ b/test/routing_test.rb @@ -2,7 +2,7 @@ require_relative "test_helper" class RoutingTest < Minitest::Test def test_query - query = Store.search("Dollar Tree", routing: "Dollar Tree", execute: false) + query = Store.search("Dollar Tree", routing: "Dollar Tree") assert_equal query.params[:routing], "Dollar Tree" end -- libgit2 0.21.0