File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,6 +82,10 @@ def jsonapi_pagination_meta(resources)
8282 numbers [ :last ] = last_page
8383 end
8484
85+ if total . present?
86+ numbers [ :records ] = total
87+ end
88+
8589 numbers
8690 end
8791
Original file line number Diff line number Diff line change 1717 it do
1818 expect ( response_json [ 'data' ] . size ) . to eq ( 0 )
1919 expect ( response_json [ 'meta' ] )
20- . to eq ( 'many' => true , 'pagination' => { 'current' => 1 } )
20+ . to eq (
21+ 'many' => true ,
22+ 'pagination' => {
23+ 'current' => 1 ,
24+ 'records' => 0
25+ }
26+ )
2127 end
2228
2329 context 'with users' do
6874 'first' => 1 ,
6975 'prev' => 1 ,
7076 'next' => 3 ,
71- 'last' => 3
77+ 'last' => 3 ,
78+ 'records' => 3
7279 )
7380 end
7481 end
8390 'first' => 1 ,
8491 'prev' => 1 ,
8592 'next' => 3 ,
86- 'last' => 3
93+ 'last' => 3 ,
94+ 'records' => 3
8795 )
8896
8997 expect ( response_json ) . to have_link ( :self )
122130 expect ( response_json [ 'meta' ] [ 'pagination' ] ) . to eq (
123131 'current' => 3 ,
124132 'first' => 1 ,
125- 'prev' => 2
133+ 'prev' => 2 ,
134+ 'records' => 3
126135 )
127136
128137 expect ( response_json ) . to have_link ( :self )
161170 expect ( response_json [ 'meta' ] [ 'pagination' ] ) . to eq (
162171 'current' => 5 ,
163172 'first' => 1 ,
164- 'prev' => 4
173+ 'prev' => 4 ,
174+ 'records' => 3
165175 )
166176 end
167177 end
173183 expect ( response_json [ 'meta' ] [ 'pagination' ] ) . to eq (
174184 'current' => 5 ,
175185 'first' => 1 ,
176- 'prev' => 4
186+ 'prev' => 4 ,
187+ 'records' => 3
177188 )
178189
179190 expect ( response_json ) . to have_link ( :self )
209220 expect ( response_json [ 'meta' ] [ 'pagination' ] ) . to eq (
210221 'current' => 1 ,
211222 'next' => 2 ,
212- 'last' => 3
223+ 'last' => 3 ,
224+ 'records' => 3
213225 )
214226
215227 expect ( response_json ) . not_to have_link ( :prev )
You can’t perform that action at this time.
0 commit comments