aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/initializers
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-05-15 06:08:55 -0700
committerwycats <wycats@gmail.com>2010-05-15 06:09:07 -0700
commit9cfeefb637b603ce41d3019c8baa95ea984620d7 (patch)
tree8503a2498cb2b111e672d72ed70502a02053d9e3 /railties/test/application/initializers
parent458f5712dce6d7f23931effe01b7f34b66e4ab3b (diff)
downloadrails-9cfeefb637b603ce41d3019c8baa95ea984620d7.tar.gz
rails-9cfeefb637b603ce41d3019c8baa95ea984620d7.tar.bz2
rails-9cfeefb637b603ce41d3019c8baa95ea984620d7.zip
Reorganized initializers a bit to enable better hooks for common cases without the need for Railtie. Specifically, the following hooks were added:
* before_configuration: this hook is run immediately after the Application class comes into existence, but before the user has added any configuration. This is the appropriate place to set configuration for your plugin * before_initialize: This is run after all of the user's configuration has completed, but before any initializers have begun (in other words, it runs right after config/environments/{development,production,test}.rb) * after_initialize: This is run after all of the initializers have run. It is an appropriate place for forking in a preforking setup Each of these hooks may be used via ActiveSupport.on_load(name) { }. In all these cases, the context inside the block will be the Application object. This means that for simple cases, you can use these hooks without needing to create a Railtie.
Diffstat (limited to 'railties/test/application/initializers')
-rw-r--r--railties/test/application/initializers/initializers_test.rb13
1 files changed, 0 insertions, 13 deletions
diff --git a/railties/test/application/initializers/initializers_test.rb b/railties/test/application/initializers/initializers_test.rb
index 2e6a707175..eca42dada6 100644
--- a/railties/test/application/initializers/initializers_test.rb
+++ b/railties/test/application/initializers/initializers_test.rb
@@ -28,19 +28,6 @@ module ApplicationTests
assert_equal "congratulations", $test_after_initialize_block2
end
- test "after_initialize block works correctly when no block is passed" do
- add_to_config <<-RUBY
- config.root = "#{app_path}"
- config.after_initialize { $test_after_initialize_block1 = "success" }
- config.after_initialize # don't pass a block, this is what we're testing!
- config.after_initialize { $test_after_initialize_block2 = "congratulations" }
- RUBY
- require "#{app_path}/config/environment"
-
- assert_equal "success", $test_after_initialize_block1
- assert_equal "congratulations", $test_after_initialize_block2
- end
-
test "after_initialize runs after frameworks have been initialized" do
$activerecord_configurations = nil
add_to_config <<-RUBY