From 2e68ecccf7ef86833cab2a99b0a42688f3fe88ac Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 25 Mar 2013 16:06:13 -0700 Subject: default RAILS_ENV to test if we're in a test task --- railties/lib/rails/all.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'railties') diff --git a/railties/lib/rails/all.rb b/railties/lib/rails/all.rb index 6c9c53fc69..19c2226619 100644 --- a/railties/lib/rails/all.rb +++ b/railties/lib/rails/all.rb @@ -1,5 +1,9 @@ require "rails" +if defined?(Rake) && Rake.application.top_level_tasks.grep(/^test(?::|$)/).any? + ENV['RAILS_ENV'] ||= 'test' +end + %w( active_record action_controller -- cgit v1.2.3