Commit 90a3a0b383413532e5f4def6b10f32e4e7f2f4be

Authored by Andrew Kane
1 parent 23c58092

Reorganized tests [skip ci]

Showing 2 changed files with 14 additions and 12 deletions   Show diff stats
test/boost_test.rb
@@ -19,16 +19,9 @@ class BoostTest < Minitest::Test @@ -19,16 +19,9 @@ class BoostTest < Minitest::Test
19 assert_order "zero", ["Zero Boost"], boost: "orders_count" 19 assert_order "zero", ["Zero Boost"], boost: "orders_count"
20 end 20 end
21 21
22 - def test_conversions_weight  
23 - Product.reindex  
24 - store [  
25 - {name: "Product Boost", orders_count: 20},  
26 - {name: "Product Conversions", conversions: {"product" => 10}}  
27 - ]  
28 - assert_order "product", ["Product Conversions", "Product Boost"], boost: "orders_count"  
29 - end 22 + # fields
30 23
31 - def test_boost_fields 24 + def test_fields
32 store [ 25 store [
33 {name: "Red", color: "White"}, 26 {name: "Red", color: "White"},
34 {name: "White", color: "Red Red Red"} 27 {name: "White", color: "Red Red Red"}
@@ -36,7 +29,7 @@ class BoostTest < Minitest::Test @@ -36,7 +29,7 @@ class BoostTest < Minitest::Test
36 assert_order "red", ["Red", "White"], fields: ["name^10", "color"] 29 assert_order "red", ["Red", "White"], fields: ["name^10", "color"]
37 end 30 end
38 31
39 - def test_boost_fields_decimal 32 + def test_fields_decimal
40 store [ 33 store [
41 {name: "Red", color: "White"}, 34 {name: "Red", color: "White"},
42 {name: "White", color: "Red Red Red"} 35 {name: "White", color: "Red Red Red"}
@@ -44,7 +37,7 @@ class BoostTest < Minitest::Test @@ -44,7 +37,7 @@ class BoostTest < Minitest::Test
44 assert_order "red", ["Red", "White"], fields: ["name^10.5", "color"] 37 assert_order "red", ["Red", "White"], fields: ["name^10.5", "color"]
45 end 38 end
46 39
47 - def test_boost_fields_word_start 40 + def test_fields_word_start
48 store [ 41 store [
49 {name: "Red", color: "White"}, 42 {name: "Red", color: "White"},
50 {name: "White", color: "Red Red Red"} 43 {name: "White", color: "Red Red Red"}
@@ -53,7 +46,7 @@ class BoostTest < Minitest::Test @@ -53,7 +46,7 @@ class BoostTest < Minitest::Test
53 end 46 end
54 47
55 # for issue #855 48 # for issue #855
56 - def test_boost_fields_apostrophes 49 + def test_fields_apostrophes
57 store_names ["Valentine's Day Special"] 50 store_names ["Valentine's Day Special"]
58 assert_search "Valentines", ["Valentine's Day Special"], fields: ["name^5"] 51 assert_search "Valentines", ["Valentine's Day Special"], fields: ["name^5"]
59 assert_search "Valentine's", ["Valentine's Day Special"], fields: ["name^5"] 52 assert_search "Valentine's", ["Valentine's Day Special"], fields: ["name^5"]
test/conversions_test.rb
@@ -45,4 +45,13 @@ class ConversionsTest < Minitest::Test @@ -45,4 +45,13 @@ class ConversionsTest < Minitest::Test
45 ] 45 ]
46 assert_order "tomato", ["Tomato A", "Tomato B"] 46 assert_order "tomato", ["Tomato A", "Tomato B"]
47 end 47 end
  48 +
  49 + def test_conversions_weight
  50 + Product.reindex
  51 + store [
  52 + {name: "Product Boost", orders_count: 20},
  53 + {name: "Product Conversions", conversions: {"product" => 10}}
  54 + ]
  55 + assert_order "product", ["Product Conversions", "Product Boost"], boost: "orders_count"
  56 + end
48 end 57 end