env()
public

Returns the hash of environment variables for this request, such as { ‘RAILS_ENV’ => ‘production’ }.

1Note

you probably want:

taryneast ยท Jan 24, 2011

Rails.env

or possibly:

ActionController::TestRequest.new (which has a demo of how to set env vars on a controller test)