Commit 729fdc2ac8990dab5a280ffae45b3740cc2dbded
1 parent
524a6519
Exists in
master
Test strings for pagination
Showing
1 changed file
with
10 additions
and
0 deletions
Show diff stats
test/pagination_test.rb
@@ -105,6 +105,16 @@ class PaginationTest < Minitest::Test | @@ -105,6 +105,16 @@ class PaginationTest < Minitest::Test | ||
105 | assert products.first_page? | 105 | assert products.first_page? |
106 | end | 106 | end |
107 | 107 | ||
108 | + def test_strings | ||
109 | + store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"] | ||
110 | + | ||
111 | + products = Product.search("product", order: {name: :asc}, page: "2", per_page: "2", padding: "1") | ||
112 | + assert_equal ["Product D", "Product E"], products.map(&:name) | ||
113 | + | ||
114 | + products = Product.search("product", order: {name: :asc}, limit: "2", offset: "3") | ||
115 | + assert_equal ["Product D", "Product E"], products.map(&:name) | ||
116 | + end | ||
117 | + | ||
108 | def test_total_entries | 118 | def test_total_entries |
109 | products = Product.search("product", total_entries: 4) | 119 | products = Product.search("product", total_entries: 4) |
110 | assert_equal 4, products.total_entries | 120 | assert_equal 4, products.total_entries |