From cb2d811ebbf3c3c9941618813f73261b3449eecf Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Thu, 5 May 2011 16:51:29 -0400 Subject: Add test to verify production rake tasks flush logger on exit --- railties/test/application/rake_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index a8bcf7beaf..d77c2d14ab 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -73,6 +73,19 @@ module ApplicationTests assert_match 'custom_assets GET /custom/assets(.:format)', Dir.chdir(app_path){ `rake routes` } end + def test_logger_is_flushed_when_exiting_production_rake_tasks + add_to_config <<-RUBY + rake_tasks do + task :log_something => :environment do + Rails.logger.error("Sample log message") + end + end + RUBY + + output = Dir.chdir(app_path){ `rake log_something RAILS_ENV=production && cat log/production.log` } + assert_match "Sample log message", output + end + def test_model_and_migration_generator_with_change_syntax Dir.chdir(app_path) do `rails generate model user username:string password:string` -- cgit v1.2.3