test/index_test.rb in searchkick-2.5.0 vs test/index_test.rb in searchkick-3.0.0

- old
+ new

@@ -57,12 +57,14 @@ store_names ["Dollar Tree"], Store assert_equal [], Store.search(body: {query: {match: {name: "dollar"}}}).map(&:name) assert_equal ["Dollar Tree"], Store.search(body: {query: {match: {name: "Dollar Tree"}}}, load: false).map(&:name) end - def test_body_warning - assert_output(nil, "The body option replaces the entire body, so the following options are ignored: where\n") { Store.search(body: {query: {match: {name: "dollar"}}}, where: {id: 1}) } + def test_body_incompatible_options + assert_raises(ArgumentError) do + Store.search(body: {query: {match: {name: "dollar"}}}, where: {id: 1}) + end end def test_block store_names ["Dollar Tree"] products = @@ -129,13 +131,14 @@ end def test_filterable # skip for 5.0 since it throws # Cannot search on field [alt_description] since it is not indexed. - skip unless elasticsearch_below50? store [{name: "Product A", alt_description: "Hello"}] - assert_search "*", [], where: {alt_description: "Hello"} + assert_raises(Searchkick::InvalidQueryError) do + assert_search "*", [], where: {alt_description: "Hello"} + end end def test_filterable_non_string store [{name: "Product A", store_id: 1}] assert_search "*", ["Product A"], where: {store_id: 1} @@ -145,18 +148,14 @@ skip if nobrainer? large_value = 1000.times.map { "hello" }.join(" ") store [{name: "Product A", text: large_value}], Region assert_search "product", ["Product A"], {}, Region assert_search "hello", ["Product A"], {fields: [:name, :text]}, Region - - # needs fields for ES 6 - if elasticsearch_below60? - assert_search "hello", ["Product A"], {}, Region - end + assert_search "hello", ["Product A"], {}, Region end def test_very_large_value - skip if nobrainer? || elasticsearch_below22? + skip if nobrainer? large_value = 10000.times.map { "hello" }.join(" ") store [{name: "Product A", text: large_value}], Region assert_search "product", ["Product A"], {}, Region assert_search "hello", ["Product A"], {fields: [:name, :text]}, Region # values that exceed ignore_above are not included in _all field :(