Commit cec64d206faa308282d28b6e3891c0dfda16c7b1

Authored by Andrew Kane
1 parent db4b9ba9

Added tests for deep_paging option

Showing 1 changed file with 14 additions and 0 deletions   Show diff stats
test/pagination_test.rb
... ... @@ -125,4 +125,18 @@ class PaginationTest < Minitest::Test
125 125 store_names ["Product B"]
126 126 assert_equal "Displaying <b>all 2</b> products", view.page_entries_info(Product.search("product"))
127 127 end
  128 +
  129 + def test_deep_paging
  130 + with_options({deep_paging: true}, Song) do
  131 + assert_empty Song.search("*", offset: 10000, limit: 1).to_a
  132 + end
  133 + end
  134 +
  135 + def test_no_deep_paging
  136 + Song.reindex
  137 + error = assert_raises(Searchkick::InvalidQueryError) do
  138 + Song.search("*", offset: 10000, limit: 1).to_a
  139 + end
  140 + assert_match "Result window is too large", error.message
  141 + end
128 142 end
... ...