diff options
author | José Valim <jose.valim@gmail.com> | 2010-05-16 00:34:54 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-16 00:36:46 +0200 |
commit | 3afdfc35e8aec7e6379e093dd1278cb3de54f21b (patch) | |
tree | 851d7463d9626f852c6ef863110b381e0d10618f /railties/test/application | |
parent | 351816fab6dbe564b7bddbd877648edb06a2bfb1 (diff) | |
download | rails-3afdfc35e8aec7e6379e093dd1278cb3de54f21b.tar.gz rails-3afdfc35e8aec7e6379e093dd1278cb3de54f21b.tar.bz2 rails-3afdfc35e8aec7e6379e093dd1278cb3de54f21b.zip |
Expose remaining hooks to minimize the need for a Railtie based on feedback from plugin developers.
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/initializers/hooks_test.rb (renamed from railties/test/application/initializers/initializers_test.rb) | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/railties/test/application/initializers/initializers_test.rb b/railties/test/application/initializers/hooks_test.rb index eca42dada6..1316bf6ee2 100644 --- a/railties/test/application/initializers/initializers_test.rb +++ b/railties/test/application/initializers/hooks_test.rb @@ -16,16 +16,34 @@ module ApplicationTests assert $foo end - test "after_initialize block works correctly" do + test "hooks block works correctly without cache classes (before_eager_load is not called)" do add_to_config <<-RUBY + $initialization_callbacks = [] config.root = "#{app_path}" - config.after_initialize { $test_after_initialize_block1 = "success" } - config.after_initialize { $test_after_initialize_block2 = "congratulations" } + config.cache_classes = false + config.before_configuration { $initialization_callbacks << 1 } + config.before_initialize { $initialization_callbacks << 2 } + config.before_eager_load { Boom } + config.after_initialize { $initialization_callbacks << 3 } RUBY + require "#{app_path}/config/environment" + assert_equal [1,2,3], $initialization_callbacks + end - assert_equal "success", $test_after_initialize_block1 - assert_equal "congratulations", $test_after_initialize_block2 + test "hooks block works correctly with cache classes" do + add_to_config <<-RUBY + $initialization_callbacks = [] + config.root = "#{app_path}" + config.cache_classes = true + config.before_configuration { $initialization_callbacks << 1 } + config.before_initialize { $initialization_callbacks << 2 } + config.before_eager_load { $initialization_callbacks << 3 } + config.after_initialize { $initialization_callbacks << 4 } + RUBY + + require "#{app_path}/config/environment" + assert_equal [1,2,3,4], $initialization_callbacks end test "after_initialize runs after frameworks have been initialized" do |