diff --git a/test/pagination_test.rb b/test/pagination_test.rb index 41bba82..d4384a9 100644 --- a/test/pagination_test.rb +++ b/test/pagination_test.rb @@ -4,11 +4,7 @@ class PaginationTest < Minitest::Test def test_limit store_names ["Product A", "Product B", "Product C", "Product D"] assert_order "product", ["Product A", "Product B"], order: {name: :asc}, limit: 2 - end - - def test_limit_relation - store_names ["Product A", "Product B", "Product C", "Product D"] - assert_equal ["Product A", "Product B"], Product.search("product", order: {name: :asc}).limit(2).map(&:name) + assert_order_relation ["Product A", "Product B"], Product.search("product").order(name: :asc).limit(2) end def test_no_limit @@ -20,11 +16,7 @@ class PaginationTest < Minitest::Test def test_offset store_names ["Product A", "Product B", "Product C", "Product D"] assert_order "product", ["Product C", "Product D"], order: {name: :asc}, offset: 2, limit: 100 - end - - def test_offset_relation - store_names ["Product A", "Product B", "Product C", "Product D"] - assert_equal ["Product C", "Product D"], Product.search("product", order: {name: :asc}).offset(2).limit(100).map(&:name) + assert_order_relation ["Product C", "Product D"], Product.search("product").order(name: :asc).offset(2).limit(100) end def test_pagination @@ -55,7 +47,7 @@ class PaginationTest < Minitest::Test def test_pagination_relation store_names ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"] - products = Product.search("product", order: {name: :asc}, padding: 1).page(2).per_page(2) + products = Product.search("product", padding: 1).order(name: :asc).page(2).per_page(2) assert_equal ["Product D", "Product E"], products.map(&:name) assert_equal "product", products.entry_name assert_equal 2, products.current_page -- libgit2 0.21.0