aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorAndy Lindeman <alindeman@gmail.com>2012-12-20 17:41:52 -0500
committerAndy Lindeman <alindeman@gmail.com>2012-12-21 17:41:39 -0500
commit6b692ee37c08f1abee8c9b8a12f9b7f1234afb00 (patch)
tree484676c70293c6ed7aa071b383593d035a43a190 /railties
parent33b3fa67c49715c98b37c737ec83937168aad859 (diff)
downloadrails-6b692ee37c08f1abee8c9b8a12f9b7f1234afb00.tar.gz
rails-6b692ee37c08f1abee8c9b8a12f9b7f1234afb00.tar.bz2
rails-6b692ee37c08f1abee8c9b8a12f9b7f1234afb00.zip
Correctly shows RAILS_ENV=development even when ENV['RAILS_ENV'] is not set (e.g., in Pow)
* Fixes #8025
Diffstat (limited to 'railties')
-rw-r--r--railties/test/application/configuration_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index ae1127b509..53109cb041 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -1,5 +1,6 @@
require "isolation/abstract_unit"
require 'rack/test'
+require 'env_helpers'
class ::MyMailInterceptor
def self.delivering_email(email); email; end
@@ -17,6 +18,7 @@ module ApplicationTests
class ConfigurationTest < ActiveSupport::TestCase
include ActiveSupport::Testing::Isolation
include Rack::Test::Methods
+ include EnvHelpers
def new_app
File.expand_path("#{app_path}/../new_app")
@@ -41,6 +43,16 @@ module ApplicationTests
FileUtils.rm_rf(new_app) if File.directory?(new_app)
end
+ test "Rails.env does not set the RAILS_ENV environment variable which would leak out into rake tasks" do
+ require "rails"
+
+ switch_env "RAILS_ENV", nil do
+ Rails.env = "development"
+ assert_equal "development", Rails.env
+ assert_nil ENV['RAILS_ENV']
+ end
+ end
+
test "a renders exception on pending migration" do
add_to_config <<-RUBY
config.active_record.migration_error = :page_load