From a5684dfa3c16472bfa5d5d861ba78cb6dbadcb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 18 Feb 2010 18:39:39 +0100 Subject: Ensure config.after_initializer is executed before building the middleware stack. --- .../test/application/initializers/initializers_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'railties/test') diff --git a/railties/test/application/initializers/initializers_test.rb b/railties/test/application/initializers/initializers_test.rb index 0c3de7ce33..a6d37b15f1 100644 --- a/railties/test/application/initializers/initializers_test.rb +++ b/railties/test/application/initializers/initializers_test.rb @@ -51,5 +51,19 @@ module ApplicationTests assert $activerecord_configurations assert $activerecord_configurations['development'] end + + test "after_initialize happens before to_prepare (i.e. before the middleware stack is built) on production" do + $order = [] + add_to_config <<-RUBY + config.after_initialize { $order << :after_initialize } + config.to_prepare { $order << :to_prepare } + RUBY + + require "#{app_path}/config/application" + Rails.env.replace "production" + require "#{app_path}/config/environment" + assert [:after_initialize, :to_prepare], $order + end + end end -- cgit v1.2.3