Skip to content

Commit

Permalink
Add test to verify production rake tasks flush logger on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrudolph committed May 6, 2011
1 parent 59982ac commit cb2d811
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions railties/test/application/rake_test.rb
Expand Up @@ -73,6 +73,19 @@ def test_rake_routes_shows_custom_assets
assert_match 'custom_assets GET /custom/assets(.:format)', Dir.chdir(app_path){ `rake routes` } assert_match 'custom_assets GET /custom/assets(.:format)', Dir.chdir(app_path){ `rake routes` }
end 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 def test_model_and_migration_generator_with_change_syntax
Dir.chdir(app_path) do Dir.chdir(app_path) do
`rails generate model user username:string password:string` `rails generate model user username:string password:string`
Expand Down

0 comments on commit cb2d811

Please sign in to comment.