Commit 6e62e02986afc071095dcc3b518b172869957f0b
1 parent
d5a5e16d
Exists in
master
and in
2 other branches
Added offset method [skip ci]
Showing
2 changed files
with
15 additions
and
0 deletions
Show diff stats
lib/searchkick/relation.rb
test/pagination_test.rb
... | ... | @@ -34,6 +34,11 @@ class PaginationTest < Minitest::Test |
34 | 34 | assert_order "product", ["Product C", "Product D"], order: {name: :asc}, offset: 2, limit: 100 |
35 | 35 | end |
36 | 36 | |
37 | + def test_offset_relation | |
38 | + store_names ["Product A", "Product B", "Product C", "Product D"] | |
39 | + assert_equal ["Product C", "Product D"], Product.search("product", order: {name: :asc}).offset(2).limit(100).map(&:name) | |
40 | + end | |
41 | + | |
37 | 42 | def test_pagination |
38 | 43 | store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"] |
39 | 44 | products = Product.search("product", order: {name: :asc}, page: 2, per_page: 2, padding: 1) | ... | ... |