File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2687,6 +2687,21 @@ def test_books_record_count_in_meta
26872687 assert_equal 'Book 0' , json_response [ 'data' ] [ 0 ] [ 'attributes' ] [ 'title' ]
26882688 end
26892689
2690+ def test_books_page_count_in_meta
2691+ Api ::V2 ::BookResource . paginator :paged
2692+ JSONAPI . configuration . top_level_meta_include_record_count = true
2693+ JSONAPI . configuration . top_level_meta_include_page_count = true
2694+ get :index , params : { include : 'book-comments' }
2695+ JSONAPI . configuration . top_level_meta_include_record_count = false
2696+ JSONAPI . configuration . top_level_meta_include_page_count = false
2697+
2698+ assert_response :success
2699+ assert_equal 901 , json_response [ 'meta' ] [ 'record-count' ]
2700+ assert_equal 91 , json_response [ 'meta' ] [ 'page-count' ]
2701+ assert_equal 10 , json_response [ 'data' ] . size
2702+ assert_equal 'Book 0' , json_response [ 'data' ] [ 0 ] [ 'attributes' ] [ 'title' ]
2703+ end
2704+
26902705 def test_books_record_count_in_meta_custom_name
26912706 Api ::V2 ::BookResource . paginator :offset
26922707 JSONAPI . configuration . top_level_meta_include_record_count = true
You can’t perform that action at this time.
0 commit comments