Permalink
Browse files

Work around strange Ruby 1.9 autoload issue by using absolute load pa…

…ths for tests (ditto for other components' tests)
  • Loading branch information...
1 parent 50f3754 commit e8ba5265e0ce0aa25925ae0542ac4455f9f61719 @jeremy jeremy committed May 24, 2010
@@ -1,9 +1,9 @@
require 'rubygems'
require 'test/unit'
-$:.unshift "#{File.dirname(__FILE__)}/../lib"
-$:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
-$:.unshift "#{File.dirname(__FILE__)}/../../actionpack/lib"
+$:.unshift File.expand_path('../../lib', __FILE__)
+$:.unshift File.expand_path('../../../activesupport/lib', __FILE__)
+$:.unshift File.expand_path('../../../actionpack/lib', __FILE__)
require 'action_mailer'
require 'action_mailer/test_case'
@@ -16,7 +16,7 @@ class ActiveRecordTestConnector
else
$stderr.print 'Attempting to load Active Record... '
begin
- PATH_TO_AR = "#{File.dirname(__FILE__)}/../../activerecord/lib"
+ PATH_TO_AR = File.expand_path('../../../activerecord/lib', __FILE__)
raise LoadError, "#{PATH_TO_AR} doesn't exist" unless File.directory?(PATH_TO_AR)
$LOAD_PATH.unshift PATH_TO_AR
require 'active_record'
@@ -2,8 +2,8 @@
require 'test/unit'
require 'active_support/test_case'
-$:.unshift "#{File.dirname(__FILE__)}/../lib"
-$:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
+$:.unshift File.expand_path('../../lib', __FILE__)
+$:.unshift File.expand_path('../../../activesupport/lib', __FILE__)
require 'active_resource'
require 'active_resource/http_mock'
@@ -4,7 +4,7 @@
ENV['NO_RELOAD'] = '1'
-$:.unshift "#{File.dirname(__FILE__)}/../lib"
+$:.unshift File.expand_path('../../lib', __FILE__)
require 'active_support'
require 'active_support/test_case'
@@ -1,9 +1,9 @@
-$:.unshift File.dirname(__FILE__) + "/../../activesupport/lib"
-$:.unshift File.dirname(__FILE__) + "/../../activerecord/lib"
-$:.unshift File.dirname(__FILE__) + "/../../actionpack/lib"
-$:.unshift File.dirname(__FILE__) + "/../../actionmailer/lib"
-$:.unshift File.dirname(__FILE__) + "/../lib"
-$:.unshift File.dirname(__FILE__) + "/../builtin/rails_info"
+$:.unshift File.expand_path('../../../activesupport/lib', __FILE__)
+$:.unshift File.expand_path('../../../activerecord/lib', __FILE__)
+$:.unshift File.expand_path('../../../actionpack/lib', __FILE__)
+$:.unshift File.expand_path('../../../actionmailer/lib', __FILE__)
+$:.unshift File.expand_path('../../lib', __FILE__)
+$:.unshift File.expand_path('../../builtin/rails_info', __FILE__)
require 'stringio'
require 'rubygems'

0 comments on commit e8ba526

Please sign in to comment.