diff options
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/abstract_unit.rb | 12 | ||||
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 26 |
2 files changed, 9 insertions, 29 deletions
diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index 77ef82856a..aa66dbb9be 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -1,15 +1,7 @@ ORIG_ARGV = ARGV.dup -root = File.expand_path('../../..', __FILE__) -begin - require "#{root}/vendor/gems/environment" -rescue LoadError - %w(activesupport activemodel activerecord actionpack actionmailer activeresource railties).each do |lib| - $:.unshift "#{root}/#{lib}/lib" - end -end - -$:.unshift "#{root}/railties/builtin/rails_info" +require File.expand_path("../../../load_paths", __FILE__) +$:.unshift File.expand_path("../../builtin/rails_info", __FILE__) require 'stringio' require 'test/unit' diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 940585836c..ff4ee6332b 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -183,23 +183,7 @@ module TestHelpers end def boot_rails - root = File.expand_path('../../../..', __FILE__) - begin - require "#{root}/vendor/gems/environment" - rescue LoadError - %w( - actionmailer/lib - actionpack/lib - activemodel/lib - activerecord/lib - activeresource/lib - activesupport/lib - railties/lib - railties - ).reverse_each do |path| - $:.unshift "#{root}/#{path}" - end - end + require File.expand_path('../../../../load_paths', __FILE__) end end end @@ -220,14 +204,18 @@ Module.new do end FileUtils.mkdir(tmp_path) - environment = File.expand_path('../../../../vendor/gems/environment', __FILE__) + environment = File.expand_path('../../../../load_paths', __FILE__) if File.exist?("#{environment}.rb") require_environment = "-r #{environment}" end `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}` File.open("#{tmp_path}/app_template/config/boot.rb", 'w') do |f| - f.puts "require '#{environment}'" if require_environment + if require_environment + f.puts "Dir.chdir('#{File.dirname(environment)}') do" + f.puts " require '#{environment}'" + f.puts "end" + end f.puts "require 'rails/all'" end end |