aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/environments/environment.rb6
-rw-r--r--railties/lib/test_help.rb4
3 files changed, 9 insertions, 3 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index d5035a68d9..4a02b8c226 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Force RAILS_ENV to be "test" when running tests, so that ENV["RAILS_ENV"] = "production" in config/environment.rb doesn't wreck havok [DHH] #2660
+
* Correct versioning in :freeze_gems Rake task. #2778 [jakob@mentalized.net, Jeremy Kemper]
* Added an omnipresent RailsInfoController with a properties action that delivers an HTML rendering of Rails::Info (but only when local_request? is true). Added a new default index.html which fetches this with Ajax. [Sam Stephenson]
diff --git a/railties/environments/environment.rb b/railties/environments/environment.rb
index a8dfe25074..dee175ce39 100644
--- a/railties/environments/environment.rb
+++ b/railties/environments/environment.rb
@@ -1,8 +1,8 @@
# Be sure to restart your web server when you modify this file.
-# Uncomment below to force Rails into production mode
-# (Use only when you can't set environment variables through your web/app server)
-# ENV['RAILS_ENV'] ||= 'production' # Keep the ||=, don't use =, or tests will wipe production db
+# Uncomment below to force Rails into production mode when
+# you don't control web/app server and can't set it the proper way
+# ENV['RAILS_ENV'] ||= 'production'
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
diff --git a/railties/lib/test_help.rb b/railties/lib/test_help.rb
index 3f3cab8a95..9238d1e244 100644
--- a/railties/lib/test_help.rb
+++ b/railties/lib/test_help.rb
@@ -1,5 +1,9 @@
require 'application'
+# Make double-sure the RAILS_ENV is set to test,
+# so fixtures are loaded to the right database
+silence_warnings { RAILS_ENV = "test" }
+
require 'test/unit'
require 'active_record/fixtures'
require 'action_controller/test_process'