From eec2d301d4ce9df9c71c1a5aa63053eb970b6818 Mon Sep 17 00:00:00 2001
From: Joshua Peek <josh@joshpeek.com>
Date: Mon, 15 Feb 2010 10:20:11 -0600
Subject: Fix test load paths for those not using bundler

---
 activemodel/Rakefile                     | 2 +-
 activemodel/test/cases/helper.rb         | 7 ++++++-
 activemodel/test/cases/tests_database.rb | 4 +++-
 3 files changed, 10 insertions(+), 3 deletions(-)

(limited to 'activemodel')

diff --git a/activemodel/Rakefile b/activemodel/Rakefile
index 14c02f183f..556ea2ec0b 100755
--- a/activemodel/Rakefile
+++ b/activemodel/Rakefile
@@ -13,7 +13,7 @@ require 'rake/testtask'
 task :default => :test
 
 Rake::TestTask.new do |t|
-  t.libs << "#{dir}/test"
+  t.libs << "test"
   t.test_files = Dir.glob("#{dir}/test/cases/**/*_test.rb").sort
   t.warning = true
 end
diff --git a/activemodel/test/cases/helper.rb b/activemodel/test/cases/helper.rb
index 8bcbe54651..8b1ab9e196 100644
--- a/activemodel/test/cases/helper.rb
+++ b/activemodel/test/cases/helper.rb
@@ -1,4 +1,9 @@
-require File.expand_path('../../../../load_paths', __FILE__)
+require File.expand_path('../../../../bundler', __FILE__)
+
+lib = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
+$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
+
+puts $LOAD_PATH.inspect
 
 require 'config'
 require 'active_model'
diff --git a/activemodel/test/cases/tests_database.rb b/activemodel/test/cases/tests_database.rb
index 8ca54d2678..4a392f609f 100644
--- a/activemodel/test/cases/tests_database.rb
+++ b/activemodel/test/cases/tests_database.rb
@@ -1,6 +1,8 @@
 require 'logger'
 
-$:.unshift(File.dirname(__FILE__) + '/../../../activerecord/lib')
+activerecord_path = File.expand_path('../../../../activerecord/lib', __FILE__)
+$:.unshift(activerecord_path) if File.directory?(activerecord_path) && !$:.include?(activerecord_path)
+
 require 'active_record'
 
 module ActiveModel
-- 
cgit v1.2.3