Skip to content

Commit d148b81

Browse files
eileencodespixeltrix
authored andcommitted
Fix keyword args dep notice
Rails now requires kwargs in test requests. This sets `params`, `format`, and `headers` accordingly to fix the deprecation warning.
1 parent 9dd3a71 commit d148b81

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/caching_test.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -252,27 +252,27 @@ def test_action_cache_with_layout_and_layout_cache_false
252252
end
253253

254254
def test_action_cache_with_layout_and_layout_cache_false_via_proc
255-
get :with_layout_proc_param, layout: false
255+
get :with_layout_proc_param, params: { layout: false }
256256
assert_response :success
257257
cached_time = content_to_cache
258258
assert_not_equal cached_time, @response.body
259259
assert fragment_exist?('hostname.com/action_caching_test/with_layout_proc_param')
260260

261-
get :with_layout_proc_param, layout: false
261+
get :with_layout_proc_param, params: { layout: false }
262262
assert_response :success
263263
assert_not_equal cached_time, @response.body
264264
body = body_to_string(read_fragment('hostname.com/action_caching_test/with_layout_proc_param'))
265265
assert_equal cached_time, body
266266
end
267267

268268
def test_action_cache_with_layout_and_layout_cache_true_via_proc
269-
get :with_layout_proc_param, layout: true
269+
get :with_layout_proc_param, params: { layout: true }
270270
assert_response :success
271271
cached_time = content_to_cache
272272
assert_not_equal cached_time, @response.body
273273
assert fragment_exist?('hostname.com/action_caching_test/with_layout_proc_param')
274274

275-
get :with_layout_proc_param, layout: true
275+
get :with_layout_proc_param, params: { layout: true }
276276
assert_response :success
277277
assert_not_equal cached_time, @response.body
278278
body = body_to_string(read_fragment('hostname.com/action_caching_test/with_layout_proc_param'))
@@ -332,7 +332,7 @@ def test_action_cache_with_custom_cache_path_in_block
332332
assert_response :success
333333
assert fragment_exist?('test.host/edit')
334334

335-
get :edit, id: 1
335+
get :edit, params: { id: 1 }
336336
assert_response :success
337337
assert fragment_exist?('test.host/1;edit')
338338
end
@@ -342,7 +342,7 @@ def test_action_cache_with_custom_cache_path_with_custom_object
342342
assert_response :success
343343
assert fragment_exist?('controller')
344344

345-
get :custom_cache_path, id: 1
345+
get :custom_cache_path, params: { id: 1 }
346346
assert_response :success
347347
assert fragment_exist?('controller-1')
348348
end
@@ -470,8 +470,8 @@ def test_xml_version_of_resource_is_treated_as_different_cache
470470

471471
def test_correct_content_type_is_returned_for_cache_hit
472472
# run it twice to cache it the first time
473-
get :index, id: 'content-type', format: 'xml'
474-
get :index, id: 'content-type', format: 'xml'
473+
get :index, params: { id: 'content-type' }, format: 'xml'
474+
get :index, params: { id: 'content-type' }, format: 'xml'
475475
assert_response :success
476476
assert_equal 'application/xml', @response.content_type
477477
end
@@ -486,8 +486,8 @@ def test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_ke
486486

487487
def test_correct_content_type_is_returned_for_cache_hit_on_action_with_string_key_from_proc
488488
# run it twice to cache it the first time
489-
get :edit, id: 1, format: 'xml'
490-
get :edit, id: 1, format: 'xml'
489+
get :edit, params: { id: 1 }, format: 'xml'
490+
get :edit, params: { id: 1 }, format: 'xml'
491491
assert_response :success
492492
assert_equal 'application/xml', @response.content_type
493493
end
@@ -500,8 +500,8 @@ def test_empty_path_is_normalized
500500
end
501501

502502
def test_file_extensions
503-
get :index, id: 'kitten.jpg'
504-
get :index, id: 'kitten.jpg'
503+
get :index, params: { id: 'kitten.jpg' }
504+
get :index, params: { id: 'kitten.jpg' }
505505

506506
assert_response :success
507507
end

0 commit comments

Comments
 (0)