diff options
author | José Valim <jose.valim@gmail.com> | 2010-05-15 23:48:56 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-15 23:49:03 +0200 |
commit | 351816fab6dbe564b7bddbd877648edb06a2bfb1 (patch) | |
tree | f55bca0e7832923efd56d9acc681bc0952b54c32 /railties/test | |
parent | 6617d0189377a2f820c8f948589bb2d4a91155af (diff) | |
download | rails-351816fab6dbe564b7bddbd877648edb06a2bfb1.tar.gz rails-351816fab6dbe564b7bddbd877648edb06a2bfb1.tar.bz2 rails-351816fab6dbe564b7bddbd877648edb06a2bfb1.zip |
Ensure that eager_load actually takes place just after the middleware stack is built by using another pattern.
Also create a engine_blank_point initializer to ensure any :before or :after hooks defined inside engines won't move the configuration initializers to other places.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/railties/engine_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index 40ac11fa03..b3f65fd00d 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -28,5 +28,31 @@ module RailtiesTest boot_rails assert !Rails::Engine.respond_to?(:config) end + + test "initializers are executed after application configuration initializers" do + @plugin.write "lib/bukkits.rb", <<-RUBY + class Bukkits + class Engine < ::Rails::Engine + initializer "dummy_initializer" do + end + end + end + RUBY + + boot_rails + + initializers = Rails.application.initializers + index = initializers.index { |i| i.name == "dummy_initializer" } + selection = initializers[(index-3)..(index)].map(&:name).map(&:to_s) + + assert_equal %w( + load_config_initializers + load_config_initializers + engines_blank_point + dummy_initializer + ), selection + + assert index < initializers.index { |i| i.name == :build_middleware_stack } + end end end |