From 51bf32701768fda1f24e5609d5c313a1479cc039 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 7 Oct 2021 19:06:12 -0300 Subject: [PATCH] Refactor using helper to swap config --- test/integration/authenticatable_test.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/integration/authenticatable_test.rb b/test/integration/authenticatable_test.rb index fbe1da6c..a1bf28da 100644 --- a/test/integration/authenticatable_test.rb +++ b/test/integration/authenticatable_test.rb @@ -344,16 +344,12 @@ class AuthenticationSessionTest < Devise::IntegrationTest end test 'refreshes _csrf_token' do - ApplicationController.allow_forgery_protection = true - - begin + swap ApplicationController, allow_forgery_protection: true do get new_user_session_path token = request.session[:_csrf_token] sign_in_as_user assert_not_equal request.session[:_csrf_token], token - ensure - ApplicationController.allow_forgery_protection = false end end