Ensure that initializers are executed before loading rake tasks

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Piotr Sarnacki 2010-11-18 17:19:29 +01:00 committed by José Valim
parent d19768b50c
commit 77fc0cc165
1 changed files with 16 additions and 0 deletions

View File

@ -34,6 +34,22 @@ module ApplicationTests
assert_match "SuperMiddleware", Dir.chdir(app_path){ `rake middleware` } assert_match "SuperMiddleware", Dir.chdir(app_path){ `rake middleware` }
end end
def test_initializers_are_executed_in_rake_tasks
add_to_config <<-RUBY
initializer "do_something" do
puts "Doing something..."
end
rake_tasks do
task :do_nothing => :environment do
end
end
RUBY
output = Dir.chdir(app_path){ `rake do_nothing` }
assert_match "Doing something...", output
end
def test_code_statistics_sanity def test_code_statistics_sanity
assert_match "Code LOC: 5 Test LOC: 0 Code to Test Ratio: 1:0.0", assert_match "Code LOC: 5 Test LOC: 0 Code to Test Ratio: 1:0.0",
Dir.chdir(app_path){ `rake stats` } Dir.chdir(app_path){ `rake stats` }