diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-11-17 01:38:58 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-11-17 01:38:58 +0000 |
commit | 4249ffe2498e9a77242205f95245ba1fcca92732 (patch) | |
tree | bfd91a2843f294d4b991dfed2678eb4625f75f76 /railties/test | |
parent | 24c9250968dda116f1383de75b08cd0bf37ad394 (diff) | |
download | rails-4249ffe2498e9a77242205f95245ba1fcca92732.tar.gz rails-4249ffe2498e9a77242205f95245ba1fcca92732.tar.bz2 rails-4249ffe2498e9a77242205f95245ba1fcca92732.zip |
Load config/preinitializer.rb, if present, before loading the environment. Closes #9943.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8159 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/boot_test.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/railties/test/boot_test.rb b/railties/test/boot_test.rb index 5d5fb09b41..930a0d552a 100644 --- a/railties/test/boot_test.rb +++ b/railties/test/boot_test.rb @@ -11,12 +11,29 @@ class BootTest < Test::Unit::TestCase assert_nil Rails.boot! end - def test_boot_picks_and_runs_if_not_booted + def test_boot_preinitializes_then_picks_and_runs_if_not_booted Rails.expects(:booted?).returns(false) + Rails.expects(:preinitialize) Rails.expects(:pick_boot).returns(mock(:run => 'result')) assert_equal 'result', Rails.boot! end + def test_preinitialize_does_not_raise_exception_if_preinitializer_file_does_not_exist + Rails.stubs(:preinitializer_path).returns('/there/is/no/such/file') + + assert_nothing_raised { Rails.preinitialize } + end + + def test_load_preinitializer_loads_preinitializer_file + Rails.stubs(:preinitializer_path).returns("#{File.dirname(__FILE__)}/fixtures/environment_with_constant.rb") + + assert_nil $initialize_test_set_from_env + Rails.preinitialize + assert_equal "success", $initialize_test_set_from_env + ensure + $initialize_test_set_from_env = nil + end + def test_boot_vendor_rails_by_default Rails.expects(:booted?).returns(false) File.expects(:exist?).with("#{RAILS_ROOT}/vendor/rails").returns(true) |