From 1b816d502444ce2b3153d8c689d0057f1c257eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 29 Apr 2010 08:39:44 +0200 Subject: The rake task :environment now loads config/environment.rb instead of initializing the application on its own. This fixes [#4492 state:resolved] and also avoids the application being initialized twice in some rake tasks. --- railties/test/application/rake_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'railties/test/application/rake_test.rb') diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index bf2da866f4..6b7a471494 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -19,5 +19,19 @@ module ApplicationTests ::Rails.application.load_tasks assert $task_loaded end + + def test_environment_is_required_in_rake_tasks + app_file "config/environment.rb", <<-RUBY + SuperMiddleware = Struct.new(:app) + + Rails::Application.configure do + config.middleware.use SuperMiddleware + end + + Rails::Application.initialize! + RUBY + + assert_match "SuperMiddleware", Dir.chdir(app_path){ `rake middleware` } + end end end \ No newline at end of file -- cgit v1.2.3