@@ -13,10 +13,8 @@ def setup
13
13
@previous_link_header = "<https://this-is-my-test-shop.myshopify.com/admin/api/unstable/orders.json?page_info=#{ @previous_page_info } >; rel=\" previous\" "
14
14
end
15
15
16
- test "navigates using next and previous link headers" do
17
- link_header =
18
- "<https://this-is-my-test-shop.myshopify.com/admin/api/unstable/orders.json?page_info=#{ @previous_page_info } >; rel=\" previous\" ,\
19
- <https://this-is-my-test-shop.myshopify.com/admin/api/unstable/orders.json?page_info=#{ @next_page_info } >; rel=\" next\" "
16
+ test "navigates using next and previous link headers with no original params" do
17
+ link_header = "#{ @previous_link_header } , #{ @next_link_header } "
20
18
21
19
fake 'orders' , :method => :get , :status => 200 , api_version : @version , :body => load_fixture ( 'orders' ) , :link => link_header
22
20
orders = ShopifyAPI ::Order . all
@@ -28,7 +26,6 @@ def setup
28
26
status : 200 ,
29
27
body : load_fixture ( 'orders' )
30
28
)
31
-
32
29
next_page = orders . fetch_next_page
33
30
assert_equal 450789469 , next_page . first . id
34
31
@@ -44,24 +41,26 @@ def setup
44
41
assert_equal 1122334455 , previous_page . first . id
45
42
end
46
43
47
- test "retains previous querystring parameters" do
44
+ test "uses all passed in querystring parameters" do
45
+ params = "page_info=#{ @next_page_info } &limit=50&fields=#{ CGI . escape ( 'id,created_at' ) } "
46
+ @next_link_header = "<https://this-is-my-test-shop.myshopify.com/admin/api/unstable/orders.json?#{ params } >; rel=\" next\" "
48
47
fake (
49
48
'orders' ,
50
49
method : :get ,
51
50
status : 200 ,
52
51
api_version : @version ,
53
- url : "https://this-is-my-test-shop.myshopify.com/admin/api/unstable/orders.json?fields=id%2Cupdated_at" ,
52
+ url : "https://this-is-my-test-shop.myshopify.com/admin/api/unstable/orders.json?fields=id%2Cupdated_at&limit=100 " ,
54
53
body : load_fixture ( 'orders' ) ,
55
54
link : @next_link_header
56
55
)
57
- orders = ShopifyAPI ::Order . where ( fields : 'id,updated_at' )
56
+ orders = ShopifyAPI ::Order . where ( fields : 'id,updated_at' , limit : 100 )
58
57
59
58
fake (
60
59
'orders' ,
61
60
method : :get ,
62
61
status : 200 ,
63
62
api_version : @version ,
64
- url : "https://this-is-my-test-shop.myshopify.com/admin/api/unstable/orders.json?fields=id%2Cupdated_at &page_info=#{ @next_page_info } " ,
63
+ url : "https://this-is-my-test-shop.myshopify.com/admin/api/unstable/orders.json?fields=id%2Ccreated_at&limit=50 &page_info=#{ @next_page_info } " ,
65
64
body : load_fixture ( 'orders' )
66
65
)
67
66
next_page = orders . fetch_next_page
0 commit comments