Commit 0e0e81921fc7e105aaae172ddc8e675d847e72c0
1 parent
ff2526ee
Exists in
master
and in
2 other branches
Fixed execute warnings in tests
Showing
4 changed files
with
14 additions
and
16 deletions
Show diff stats
benchmark/search.rb
... | ... | @@ -45,7 +45,7 @@ if ENV["SETUP"] |
45 | 45 | puts "Reindexed" |
46 | 46 | end |
47 | 47 | |
48 | -query = Product.search("product", fields: [:name], where: {color: "red", store_id: 5}, limit: 10000, load: false, execute: false) | |
48 | +query = Product.search("product", fields: [:name], where: {color: "red", store_id: 5}, limit: 10000, load: false) | |
49 | 49 | |
50 | 50 | require "pp" |
51 | 51 | pp query.body.as_json | ... | ... |
test/multi_search_test.rb
... | ... | @@ -4,8 +4,8 @@ class MultiSearchTest < Minitest::Test |
4 | 4 | def test_basic |
5 | 5 | store_names ["Product A"] |
6 | 6 | store_names ["Store A"], Store |
7 | - products = Product.search("*", execute: false) | |
8 | - stores = Store.search("*", execute: false) | |
7 | + products = Product.search("*") | |
8 | + stores = Store.search("*") | |
9 | 9 | Searchkick.multi_search([products, stores]) |
10 | 10 | assert_equal ["Product A"], products.map(&:name) |
11 | 11 | assert_equal ["Store A"], stores.map(&:name) |
... | ... | @@ -13,14 +13,14 @@ class MultiSearchTest < Minitest::Test |
13 | 13 | |
14 | 14 | def test_methods |
15 | 15 | result = Product.search("*") |
16 | - query = Product.search("*", execute: false) | |
16 | + query = Product.search("*") | |
17 | 17 | assert_empty(result.methods - query.methods) |
18 | 18 | end |
19 | 19 | |
20 | 20 | def test_error |
21 | 21 | store_names ["Product A"] |
22 | - products = Product.search("*", execute: false) | |
23 | - stores = Store.search("*", order: [:bad_field], execute: false) | |
22 | + products = Product.search("*") | |
23 | + stores = Store.search("*", order: [:bad_field]) | |
24 | 24 | Searchkick.multi_search([products, stores]) |
25 | 25 | assert !products.error |
26 | 26 | assert stores.error |
... | ... | @@ -28,13 +28,13 @@ class MultiSearchTest < Minitest::Test |
28 | 28 | |
29 | 29 | def test_misspellings_below_unmet |
30 | 30 | store_names ["abc", "abd", "aee"] |
31 | - products = Product.search("abc", misspellings: {below: 5}, execute: false) | |
31 | + products = Product.search("abc", misspellings: {below: 5}) | |
32 | 32 | Searchkick.multi_search([products]) |
33 | 33 | assert_equal ["abc", "abd"], products.map(&:name) |
34 | 34 | end |
35 | 35 | |
36 | 36 | def test_query_error |
37 | - products = Product.search("*", order: {bad_column: :asc}, execute: false) | |
37 | + products = Product.search("*", order: {bad_column: :asc}) | |
38 | 38 | Searchkick.multi_search([products]) |
39 | 39 | assert products.error |
40 | 40 | error = assert_raises(Searchkick::Error) { products.results } | ... | ... |
test/query_test.rb
... | ... | @@ -3,10 +3,8 @@ require_relative "test_helper" |
3 | 3 | class QueryTest < Minitest::Test |
4 | 4 | def test_basic |
5 | 5 | store_names ["Milk", "Apple"] |
6 | - query = Product.search("milk", execute: false) | |
7 | - query.body[:query] = {match_all: {}} | |
6 | + query = Product.search("milk", body: {query: {match_all: {}}}) | |
8 | 7 | assert_equal ["Apple", "Milk"], query.map(&:name).sort |
9 | - assert_equal ["Apple", "Milk"], query.execute.map(&:name).sort | |
10 | 8 | end |
11 | 9 | |
12 | 10 | def test_with_uneffective_min_score |
... | ... | @@ -15,15 +13,15 @@ class QueryTest < Minitest::Test |
15 | 13 | end |
16 | 14 | |
17 | 15 | def test_default_timeout |
18 | - assert_equal "6s", Product.search("*", execute: false).body[:timeout] | |
16 | + assert_equal "6s", Product.search("*").body[:timeout] | |
19 | 17 | end |
20 | 18 | |
21 | 19 | def test_timeout_override |
22 | - assert_equal "1s", Product.search("*", body_options: {timeout: "1s"}, execute: false).body[:timeout] | |
20 | + assert_equal "1s", Product.search("*", body_options: {timeout: "1s"}).body[:timeout] | |
23 | 21 | end |
24 | 22 | |
25 | 23 | def test_request_params |
26 | - assert_equal "dfs_query_then_fetch", Product.search("*", request_params: {search_type: "dfs_query_then_fetch"}, execute: false).params[:search_type] | |
24 | + assert_equal "dfs_query_then_fetch", Product.search("*", request_params: {search_type: "dfs_query_then_fetch"}).params[:search_type] | |
27 | 25 | end |
28 | 26 | |
29 | 27 | def test_debug |
... | ... | @@ -44,7 +42,7 @@ class QueryTest < Minitest::Test |
44 | 42 | # body_options |
45 | 43 | |
46 | 44 | def test_body_options_should_merge_into_body |
47 | - query = Product.search("*", body_options: {min_score: 1.0}, execute: false) | |
45 | + query = Product.search("*", body_options: {min_score: 1.0}) | |
48 | 46 | assert_equal 1.0, query.body[:min_score] |
49 | 47 | end |
50 | 48 | ... | ... |
test/routing_test.rb
... | ... | @@ -2,7 +2,7 @@ require_relative "test_helper" |
2 | 2 | |
3 | 3 | class RoutingTest < Minitest::Test |
4 | 4 | def test_query |
5 | - query = Store.search("Dollar Tree", routing: "Dollar Tree", execute: false) | |
5 | + query = Store.search("Dollar Tree", routing: "Dollar Tree") | |
6 | 6 | assert_equal query.params[:routing], "Dollar Tree" |
7 | 7 | end |
8 | 8 | ... | ... |