From cec64d206faa308282d28b6e3891c0dfda16c7b1 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 18 May 2022 13:22:34 -0700 Subject: [PATCH] Added tests for deep_paging option --- test/pagination_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+), 0 deletions(-) diff --git a/test/pagination_test.rb b/test/pagination_test.rb index d4384a9..5540f66 100644 --- a/test/pagination_test.rb +++ b/test/pagination_test.rb @@ -125,4 +125,18 @@ class PaginationTest < Minitest::Test store_names ["Product B"] assert_equal "Displaying all 2 products", view.page_entries_info(Product.search("product")) end + + def test_deep_paging + with_options({deep_paging: true}, Song) do + assert_empty Song.search("*", offset: 10000, limit: 1).to_a + end + end + + def test_no_deep_paging + Song.reindex + error = assert_raises(Searchkick::InvalidQueryError) do + Song.search("*", offset: 10000, limit: 1).to_a + end + assert_match "Result window is too large", error.message + end end -- libgit2 0.21.0