2005-10-23 09:39:24 -04:00
|
|
|
$:.unshift File.dirname(__FILE__) + "/../lib"
|
|
|
|
$:.unshift File.dirname(__FILE__) + "/../../activesupport/lib"
|
|
|
|
|
|
|
|
require 'test/unit'
|
|
|
|
require 'active_support'
|
|
|
|
require 'initializer'
|
|
|
|
|
|
|
|
class InitializerTest < Test::Unit::TestCase
|
|
|
|
class ConfigurationMock < Rails::Configuration
|
|
|
|
def initialize(envpath)
|
|
|
|
super()
|
|
|
|
@envpath = envpath
|
|
|
|
end
|
|
|
|
|
|
|
|
def environment_path
|
|
|
|
@envpath
|
|
|
|
end
|
|
|
|
|
2005-11-07 03:09:38 -05:00
|
|
|
protected
|
|
|
|
def root_path
|
|
|
|
File.dirname(__FILE__)
|
|
|
|
end
|
2005-10-23 09:39:24 -04:00
|
|
|
end
|
2005-11-07 03:09:38 -05:00
|
|
|
|
2005-10-23 09:39:24 -04:00
|
|
|
def test_load_environment_with_constant
|
|
|
|
config = ConfigurationMock.new("#{File.dirname(__FILE__)}/fixtures/environment_with_constant.rb")
|
2005-11-07 03:09:38 -05:00
|
|
|
assert_nil $initialize_test_set_from_env
|
2005-10-23 09:39:24 -04:00
|
|
|
Rails::Initializer.run(:load_environment, config)
|
2005-11-07 03:09:38 -05:00
|
|
|
assert_equal "success", $initialize_test_set_from_env
|
2005-10-23 09:39:24 -04:00
|
|
|
ensure
|
2005-11-07 03:09:38 -05:00
|
|
|
$initialize_test_set_from_env = nil
|
2005-10-23 09:39:24 -04:00
|
|
|
end
|
2005-11-07 03:09:38 -05:00
|
|
|
end
|