2007-03-29 01:44:44 -04:00
|
|
|
require "#{File.dirname(__FILE__)}/abstract_unit"
|
2005-10-23 09:39:24 -04:00
|
|
|
require 'initializer'
|
|
|
|
|
|
|
|
class InitializerTest < Test::Unit::TestCase
|
|
|
|
class ConfigurationMock < Rails::Configuration
|
2007-03-29 01:44:44 -04:00
|
|
|
attr_reader :environment_path
|
|
|
|
|
2005-10-23 09:39:24 -04:00
|
|
|
def initialize(envpath)
|
|
|
|
super()
|
2007-03-29 01:44:44 -04:00
|
|
|
@environment_path = envpath
|
2005-10-23 09:39:24 -04:00
|
|
|
end
|
|
|
|
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
|