@@ -47,13 +47,13 @@ def test_can_parse_pagination_links
47
47
} ] ,
48
48
links : {
49
49
self : "http://example.com/articles" ,
50
- next : "http://example.com/articles?page=2" ,
50
+ next : "http://example.com/articles?page[page] =2" ,
51
51
prev : nil ,
52
52
first : "http://example.com/articles" ,
53
- last : "http://example.com/articles?page=6"
53
+ last : "http://example.com/articles?page[page] =6"
54
54
}
55
55
} . to_json )
56
- stub_request ( :get , "http://example.com/articles?page=2" )
56
+ stub_request ( :get , "http://example.com/articles?page[page] =2" )
57
57
. to_return ( headers : { content_type : "application/vnd.api+json" } , body : {
58
58
data : [ {
59
59
type : "articles" ,
@@ -63,19 +63,19 @@ def test_can_parse_pagination_links
63
63
}
64
64
} ] ,
65
65
links : {
66
- self : "http://example.com/articles?page=2" ,
67
- next : "http://example.com/articles?page=3" ,
66
+ self : "http://example.com/articles?page[page] =2" ,
67
+ next : "http://example.com/articles?page[page] =3" ,
68
68
prev : "http://example.com/articles" ,
69
69
first : "http://example.com/articles" ,
70
- last : "http://example.com/articles?page=6"
70
+ last : "http://example.com/articles?page[page] =6"
71
71
}
72
72
} . to_json )
73
73
74
74
assert_pagination
75
75
end
76
76
77
77
def test_can_parse_pagination_links_with_custom_config
78
- JsonApiClient ::Paginating ::Paginator . page_param = "page[ number] "
78
+ JsonApiClient ::Paginating ::Paginator . page_param = "number"
79
79
80
80
stub_request ( :get , "http://example.com/articles" )
81
81
. to_return ( headers : { content_type : "application/vnd.api+json" } , body : {
@@ -114,6 +114,7 @@ def test_can_parse_pagination_links_with_custom_config
114
114
115
115
assert_pagination
116
116
117
+ ensure
117
118
JsonApiClient ::Paginating ::Paginator . page_param = "page"
118
119
end
119
120
@@ -131,7 +132,7 @@ def test_can_parse_pagination_links_when_no_next_page
131
132
self : "http://example.com/articles" ,
132
133
prev : nil ,
133
134
first : "http://example.com/articles" ,
134
- last : "http://example.com/articles?page=1"
135
+ last : "http://example.com/articles?page[page] =1"
135
136
}
136
137
} . to_json )
137
138
@@ -154,7 +155,7 @@ def test_can_parse_complex_pagination_links
154
155
meta : { }
155
156
} ,
156
157
next : {
157
- href : "http://example.com/articles?page=2" ,
158
+ href : "http://example.com/articles?page[page] =2" ,
158
159
meta : { }
159
160
} ,
160
161
prev : nil ,
@@ -163,12 +164,12 @@ def test_can_parse_complex_pagination_links
163
164
meta : { }
164
165
} ,
165
166
last : {
166
- href : "http://example.com/articles?page=6" ,
167
+ href : "http://example.com/articles?page[page] =6" ,
167
168
meta : { }
168
169
}
169
170
}
170
171
} . to_json )
171
- stub_request ( :get , "http://example.com/articles?page=2" )
172
+ stub_request ( :get , "http://example.com/articles?page[page] =2" )
172
173
. to_return ( headers : { content_type : "application/vnd.api+json" } , body : {
173
174
data : [ {
174
175
type : "articles" ,
@@ -179,11 +180,11 @@ def test_can_parse_complex_pagination_links
179
180
} ] ,
180
181
links : {
181
182
self : {
182
- href : "http://example.com/articles?page=2" ,
183
+ href : "http://example.com/articles?page[page] =2" ,
183
184
meta : { }
184
185
} ,
185
186
next : {
186
- href : "http://example.com/articles?page=3" ,
187
+ href : "http://example.com/articles?page[page] =3" ,
187
188
meta : { }
188
189
} ,
189
190
prev : {
@@ -195,7 +196,7 @@ def test_can_parse_complex_pagination_links
195
196
meta : { }
196
197
} ,
197
198
last : {
198
- href : "http://example.com/articles?page=6" ,
199
+ href : "http://example.com/articles?page[page] =6" ,
199
200
meta : { }
200
201
}
201
202
}
0 commit comments