# For the API
ActionController::Metal.class_eval do
  def spree_current_user
    @spree_current_user ||= env['warden'].user
  end
end

# For the API
ActionController::Metal.class_eval do
  def spree_current_user
    @spree_current_user ||= request.env['warden'].user
  end
end

Fix `env` deprecated in Rails 5.0
Fix `env` deprecated in Rails 5.0

I found it at the very bottom of the `test-consumer-features` CI build
job. See: https://github.com/rails/rails/issues/23294.
