diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-21 15:31:15 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-21 15:31:15 -0800 |
commit | bc8d2f6a628dedeb091e4262a3a1b59d0749b1a6 (patch) | |
tree | 52d61165fac5f1c410b9918afa30289180833c48 /railties/test | |
parent | 625699aa6c1122a0158f421e43aa8b1033586035 (diff) | |
parent | 6b692ee37c08f1abee8c9b8a12f9b7f1234afb00 (diff) | |
download | rails-bc8d2f6a628dedeb091e4262a3a1b59d0749b1a6.tar.gz rails-bc8d2f6a628dedeb091e4262a3a1b59d0749b1a6.tar.bz2 rails-bc8d2f6a628dedeb091e4262a3a1b59d0749b1a6.zip |
Merge pull request #8574 from alindeman/rails_env
Correctly shows RAILS_ENV=development even when ENV['RAILS_ENV'] is not set (e.g., in Pow)
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/configuration_test.rb | 12 |
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 |