File tree Expand file tree Collapse file tree
test/integration/requests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ def pagination_params
175175 def options
176176 opts = { }
177177 opts . merge! ( pagination_params : pagination_params ) if JSONAPI . configuration . top_level_links_include_pagination
178- opts . merge! ( record_count : pagination_params ) if JSONAPI . configuration . top_level_meta_include_record_count
178+ opts . merge! ( record_count : record_count ) if JSONAPI . configuration . top_level_meta_include_record_count
179179 opts
180180 end
181181
Original file line number Diff line number Diff line change @@ -398,6 +398,19 @@ def test_pagination_related_resources_links
398398 assert_equal 'http://www.example.com/api/v2/books/1/book_comments?page%5Blimit%5D=10&page%5Boffset%5D=41' , json_response [ 'links' ] [ 'last' ]
399399 end
400400
401+ def test_pagination_related_resources_links_meta
402+ Api ::V2 ::BookResource . paginator :offset
403+ Api ::V2 ::BookCommentResource . paginator :offset
404+ JSONAPI . configuration . top_level_meta_include_record_count = true
405+ get '/api/v2/books/1/book_comments?page[limit]=10'
406+ assert_equal 51 , json_response [ 'meta' ] [ 'record_count' ]
407+ assert_equal 'http://www.example.com/api/v2/books/1/book_comments?page%5Blimit%5D=10&page%5Boffset%5D=0' , json_response [ 'links' ] [ 'first' ]
408+ assert_equal 'http://www.example.com/api/v2/books/1/book_comments?page%5Blimit%5D=10&page%5Boffset%5D=10' , json_response [ 'links' ] [ 'next' ]
409+ assert_equal 'http://www.example.com/api/v2/books/1/book_comments?page%5Blimit%5D=10&page%5Boffset%5D=41' , json_response [ 'links' ] [ 'last' ]
410+ ensure
411+ JSONAPI . configuration . top_level_meta_include_record_count = false
412+ end
413+
401414 def test_pagination_related_resources_without_related
402415 Api ::V2 ::BookResource . paginator :offset
403416 Api ::V2 ::BookCommentResource . paginator :offset
You can’t perform that action at this time.
0 commit comments