aboutsummaryrefslogblamecommitdiffstats
path: root/railties/test/initializer_test.rb
blob: cf333e878ea0c610f10a655633e720aef02b1a3b (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                 



                                                

                                 

                           
                                 
       
     
 

                                                                                                     
                                            
                                                     
                                                         
        
                                       
     
   
require "#{File.dirname(__FILE__)}/abstract_unit"
require 'initializer'

class InitializerTest < Test::Unit::TestCase
  class ConfigurationMock < Rails::Configuration
    attr_reader :environment_path

    def initialize(envpath)
      super()
      @environment_path = envpath
    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