Permalink
Browse files

Ensure that initializers are executed before loading rake tasks

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent d19768b commit 77fc0cc165bb389527edc7eae3cf2c4249da857f @drogus drogus committed with josevalim Nov 18, 2010
Showing with 16 additions and 0 deletions.
  1. +16 −0 railties/test/application/rake_test.rb
@@ -34,6 +34,22 @@ def test_environment_is_required_in_rake_tasks
assert_match "SuperMiddleware", Dir.chdir(app_path){ `rake middleware` }
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
assert_match "Code LOC: 5 Test LOC: 0 Code to Test Ratio: 1:0.0",
Dir.chdir(app_path){ `rake stats` }

0 comments on commit 77fc0cc

Please sign in to comment.