Commit b30c600a8aa9ddee153af20b08994325e787d12c

Authored by Andrew Kane
1 parent a5dfd102

Updated test names [skip ci]

Showing 2 changed files with 11 additions and 11 deletions   Show diff stats
test/routing_test.rb
1 require_relative "test_helper" 1 require_relative "test_helper"
2 2
3 class RoutingTest < Minitest::Test 3 class RoutingTest < Minitest::Test
4 - def test_routing_query 4 + def test_query
5 query = Store.search("Dollar Tree", routing: "Dollar Tree", execute: false) 5 query = Store.search("Dollar Tree", routing: "Dollar Tree", execute: false)
6 assert_equal query.params[:routing], "Dollar Tree" 6 assert_equal query.params[:routing], "Dollar Tree"
7 end 7 end
8 8
9 - def test_routing_mappings 9 + def test_mappings
10 mappings = Store.searchkick_index.index_options[:mappings] 10 mappings = Store.searchkick_index.index_options[:mappings]
11 if Searchkick.server_below?("7.0.0") 11 if Searchkick.server_below?("7.0.0")
12 mappings = mappings[:store] 12 mappings = mappings[:store]
@@ -14,24 +14,24 @@ class RoutingTest &lt; Minitest::Test @@ -14,24 +14,24 @@ class RoutingTest &lt; Minitest::Test
14 assert_equal mappings[:_routing], required: true 14 assert_equal mappings[:_routing], required: true
15 end 15 end
16 16
17 - def test_routing_correct_node 17 + def test_correct_node
18 store_names ["Dollar Tree"], Store 18 store_names ["Dollar Tree"], Store
19 assert_search "*", ["Dollar Tree"], {routing: "Dollar Tree"}, Store 19 assert_search "*", ["Dollar Tree"], {routing: "Dollar Tree"}, Store
20 end 20 end
21 21
22 - def test_routing_incorrect_node 22 + def test_incorrect_node
23 store_names ["Dollar Tree"], Store 23 store_names ["Dollar Tree"], Store
24 assert_search "*", ["Dollar Tree"], {routing: "Boom"}, Store 24 assert_search "*", ["Dollar Tree"], {routing: "Boom"}, Store
25 end 25 end
26 26
27 - def test_routing_async 27 + def test_async
28 with_options({routing: true, callbacks: :async}, Song) do 28 with_options({routing: true, callbacks: :async}, Song) do
29 store_names ["Dollar Tree"], Song 29 store_names ["Dollar Tree"], Song
30 Song.destroy_all 30 Song.destroy_all
31 end 31 end
32 end 32 end
33 33
34 - def test_routing_queue 34 + def test_queue
35 with_options({routing: true, callbacks: :queue}, Song) do 35 with_options({routing: true, callbacks: :queue}, Song) do
36 store_names ["Dollar Tree"], Song 36 store_names ["Dollar Tree"], Song
37 Song.destroy_all 37 Song.destroy_all
test/scroll_test.rb
1 require_relative "test_helper" 1 require_relative "test_helper"
2 2
3 class ScrollTest < Minitest::Test 3 class ScrollTest < Minitest::Test
4 - def test_scroll 4 + def test_works
5 store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"] 5 store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"]
6 products = Product.search("product", order: {name: :asc}, scroll: '1m', per_page: 2) 6 products = Product.search("product", order: {name: :asc}, scroll: '1m', per_page: 2)
7 assert_equal ["Product A", "Product B"], products.map(&:name) 7 assert_equal ["Product A", "Product B"], products.map(&:name)
@@ -25,7 +25,7 @@ class ScrollTest &lt; Minitest::Test @@ -25,7 +25,7 @@ class ScrollTest &lt; Minitest::Test
25 assert_equal [], products.map(&:name) 25 assert_equal [], products.map(&:name)
26 end 26 end
27 27
28 - def test_scroll_body 28 + def test_body
29 store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"] 29 store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"]
30 products = Product.search("product", body: {query: {match_all: {}}, sort: [{name: "asc"}]}, scroll: '1m', per_page: 2) 30 products = Product.search("product", body: {query: {match_all: {}}, sort: [{name: "asc"}]}, scroll: '1m', per_page: 2)
31 assert_equal ["Product A", "Product B"], products.map(&:name) 31 assert_equal ["Product A", "Product B"], products.map(&:name)
@@ -49,12 +49,12 @@ class ScrollTest &lt; Minitest::Test @@ -49,12 +49,12 @@ class ScrollTest &lt; Minitest::Test
49 assert_equal [], products.map(&:name) 49 assert_equal [], products.map(&:name)
50 end 50 end
51 51
52 - def test_scroll_all 52 + def test_all
53 store_names ["Product A"] 53 store_names ["Product A"]
54 assert_equal ["Product A"], Product.search("*", scroll: "1m").map(&:name) 54 assert_equal ["Product A"], Product.search("*", scroll: "1m").map(&:name)
55 end 55 end
56 56
57 - def test_scroll_no_option 57 + def test_no_option
58 products = Product.search("*") 58 products = Product.search("*")
59 error = assert_raises Searchkick::Error do 59 error = assert_raises Searchkick::Error do
60 products.scroll 60 products.scroll
@@ -62,7 +62,7 @@ class ScrollTest &lt; Minitest::Test @@ -62,7 +62,7 @@ class ScrollTest &lt; Minitest::Test
62 assert_match /Pass .+ option/, error.message 62 assert_match /Pass .+ option/, error.message
63 end 63 end
64 64
65 - def test_scroll_block 65 + def test_block
66 store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"] 66 store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"]
67 batches_count = 0 67 batches_count = 0
68 Product.search("*", scroll: "1m", per_page: 2).scroll do |batch| 68 Product.search("*", scroll: "1m", per_page: 2).scroll do |batch|