1313 let ( :per_page ) { response . headers [ 'Per-Page' ] . to_i }
1414
1515 context 'without enough items to give more than one page' do
16- before { get :index , : count => 10 }
16+ before { get :index , params : { count : 10 } }
1717
1818 it 'should not paginate' do
1919 expect ( response . headers . keys ) . not_to include ( 'Link' )
3434 end
3535
3636 context 'with existing Link headers' do
37- before { get :index , : count => 30 , : with_headers => true }
37+ before { get :index , params : { count : 30 , with_headers : true } }
3838
3939 it_behaves_like 'an endpoint with existing Link headers'
4040 end
4141
4242 context 'with enough items to paginate' do
4343 context 'when on the first page' do
44- before { get :index , : count => 100 }
44+ before { get :index , params : { count : 100 } }
4545
4646 it_behaves_like 'an endpoint with a first page'
4747 end
4848
4949 context 'when on the last page' do
50- before { get :index , : count => 100 , : page => 10 }
50+ before { get :index , params : { count : 100 , page : 10 } }
5151
5252 it_behaves_like 'an endpoint with a last page'
5353 end
5454
5555 context 'when somewhere comfortably in the middle' do
56- before { get :index , : count => 100 , : page => 2 }
56+ before { get :index , params : { count : 100 , page : 2 } }
5757
5858 it_behaves_like 'an endpoint with a middle page'
5959 end
6060 end
6161
6262 context 'providing a block' do
6363 it 'yields to the block instead of implicitly rendering' do
64- get :index_with_custom_render , : count => 100
64+ get :index_with_custom_render , params : { count : 100 }
6565
6666 json = { numbers : ( 1 ..10 ) . map { |n | { number : n } } } . to_json
6767
7575 ApiPagination . config . per_page_header = 'X-Per-Page'
7676 ApiPagination . config . page_header = 'X-Page'
7777
78- get :index , count : 10
78+ get :index , params : { count : 10 }
7979 end
8080
8181 after do
116116 before { ApiPagination . config . include_total = false }
117117
118118 it 'should not include a Total header' do
119- get :index , count : 10
119+ get :index , params : { count : 10 }
120120
121121 expect ( response . header [ 'Total' ] ) . to be_nil
122122 end
137137 end
138138
139139 it 'should work' do
140- get :index , : foo => 2 , : count => 100
140+ get :index , params : { foo : 2 , count : 100 }
141141
142142 expect ( response . header [ 'Page' ] ) . to eq ( '2' )
143143 end
158158 end
159159
160160 it 'should work' do
161- get :index , :foo => { : bar => 2 } , : count => 100
161+ get :index , params : { foo : { bar : 2 } , count : 100 }
162162
163163 expect ( response . header [ 'Page' ] ) . to eq ( '2' )
164164 end
176176 end
177177
178178 it 'should work' do
179- get :index_with_no_per_page , : foo => 2 , : count => 100
179+ get :index_with_no_per_page , params : { foo : 2 , count : 100 }
180180
181181 expect ( response . header [ 'Per-Page' ] ) . to eq ( '2' )
182182 end
194194 end
195195
196196 it 'should work' do
197- get :index_with_no_per_page , :foo => { : bar => 2 } , : count => 100
197+ get :index_with_no_per_page , params : { foo : { bar : 2 } , count : 100 }
198198
199199 expect ( response . header [ 'Per-Page' ] ) . to eq ( '2' )
200200 end
211211 end
212212
213213 specify do
214- get :index_with_paginate_array_options , params
214+ get :index_with_paginate_array_options , params : params
215215 expect ( response . header [ 'Total' ] . to_i ) . to eq total_header
216216 end
217217 end
@@ -267,7 +267,7 @@ class Fixnum
267267 end
268268
269269 it 'should use default per page from model' do
270- get :index_with_no_per_page , count : 100
270+ get :index_with_no_per_page , params : { count : 100 }
271271
272272 expect ( response . header [ 'Per-Page' ] ) . to eq ( '6' )
273273 end
@@ -278,7 +278,7 @@ class Fixnum
278278 @per_page = nil
279279 end
280280
281- get :index_with_no_per_page , count : 100
281+ get :index_with_no_per_page , params : { count : 100 }
282282
283283 expect ( response . header [ 'Per-Page' ] ) . to eq (
284284 case ApiPagination . config . paginator
0 commit comments