aboutsummaryrefslogblamecommitdiffstats
path: root/railties/test/initializer_test.rb
blob: 86f7569c50debdeffe55137b6ef2ca4effc64e8d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                              
 



                              
     
 

                                                                                                     
                                            
                                                     
                                                         
        
                                       
     
   
$:.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

    protected
      def root_path
        File.dirname(__FILE__)
      end
  end

  def test_load_environment_with_constant
    config = ConfigurationMock.new("#{File.dirname(__FILE__)}/fixtures/environment_with_constant.rb")
    assert_nil $initialize_test_set_from_env
    Rails::Initializer.run(:load_environment, config)
    assert_equal "success", $initialize_test_set_from_env
  ensure
    $initialize_test_set_from_env = nil
  end
end