Disabling protect_from_forgery for test environment

I have put this code to disable protect_from_forgery for test environment. The code is given below and i have given the code in bold. that is the one i’m talking about…

class ApplicationController < ActionController::Base

protect_from_forgery with: :exception, unless: → { Rails.env.test? }

end

I have currently put this code in application controller. is there a better place put this code? I need some advice here… can anyone advise me please?