In my application_controller, I have the following set to include the locale with all paths generated by url_for:
def default_url_options(options={})
{
Things changed again with Ruby 5.1. Here's what worked for me:
class ActionController::TestCase
module Behavior
module LocaleParameter
def process(action, params: {}, **args)
# Locale parameter must be a string
params[:locale] = I18n.locale.to_s
super(action, params: params, **args)
end
end
end
prepend Behavior::LocaleParameter
end