Fix Rails environment when running tests with Ruby
#31355

tenderlove wants to merge fix-rails-env-with-ruby into master

We do not currently have an analysis of these two commits