aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/env_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/env_helpers.rb')
-rw-r--r--railties/test/env_helpers.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/railties/test/env_helpers.rb b/railties/test/env_helpers.rb
index fea06e528f..330fe150ca 100644
--- a/railties/test/env_helpers.rb
+++ b/railties/test/env_helpers.rb
@@ -12,6 +12,15 @@ module EnvHelpers
end
end
+ def with_rack_env(env)
+ Rails.instance_variable_set :@_env, nil
+ switch_env 'RACK_ENV', env do
+ switch_env 'RAILS_ENV', nil do
+ yield
+ end
+ end
+ end
+
def switch_env(key, value)
old, ENV[key] = ENV[key], value
yield