Add test for #16622 as of a6de6f5

cc @chancancode 
Yeah. I'd use `with_rails_env` here.