From 729fdc2ac8990dab5a280ffae45b3740cc2dbded Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Mon, 7 Nov 2022 12:26:39 -0800 Subject: [PATCH] Test strings for pagination --- test/pagination_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+), 0 deletions(-) diff --git a/test/pagination_test.rb b/test/pagination_test.rb index 52edb4f..97f1247 100644 --- a/test/pagination_test.rb +++ b/test/pagination_test.rb @@ -105,6 +105,16 @@ class PaginationTest < Minitest::Test assert products.first_page? end + def test_strings + store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"] + + products = Product.search("product", order: {name: :asc}, page: "2", per_page: "2", padding: "1") + assert_equal ["Product D", "Product E"], products.map(&:name) + + products = Product.search("product", order: {name: :asc}, limit: "2", offset: "3") + assert_equal ["Product D", "Product E"], products.map(&:name) + end + def test_total_entries products = Product.search("product", total_entries: 4) assert_equal 4, products.total_entries -- libgit2 0.21.0