diff options
author | Carl Lerche <carllerche@mac.com> | 2010-01-31 16:33:06 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-01-31 19:13:43 -0800 |
commit | 9f01dff9c203821bf4ac6d7b885f1d6b018d5c79 (patch) | |
tree | 5e7c4be2aec0f7e2bff6eac4e066a16dc4e269ad | |
parent | 9bd0422dd7b4fc9f3bebf6301b144c6a5f35c26b (diff) | |
download | rails-9f01dff9c203821bf4ac6d7b885f1d6b018d5c79.tar.gz rails-9f01dff9c203821bf4ac6d7b885f1d6b018d5c79.tar.bz2 rails-9f01dff9c203821bf4ac6d7b885f1d6b018d5c79.zip |
Get rails tests running on bundler 0.9
-rw-r--r-- | Gemfile | 19 | ||||
-rw-r--r-- | actionmailer/test/abstract_unit.rb | 9 | ||||
-rw-r--r-- | actionpack/test/abstract_unit.rb | 11 | ||||
-rw-r--r-- | activemodel/test/cases/helper.rb | 8 | ||||
-rw-r--r-- | activerecord/test/cases/helper.rb | 9 | ||||
-rw-r--r-- | activeresource/test/abstract_unit.rb | 8 | ||||
-rw-r--r-- | activesupport/test/abstract_unit.rb | 10 | ||||
-rw-r--r-- | load_paths.rb | 21 | ||||
-rw-r--r-- | railties/Rakefile | 5 | ||||
-rw-r--r-- | railties/test/abstract_unit.rb | 12 | ||||
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 26 |
11 files changed, 46 insertions, 92 deletions
@@ -1,17 +1,20 @@ -gem "rake", ">= 0.8.7" +path File.expand_path('..', __FILE__) +source :gemcutter + +gem "rails", "3.0.pre" + +gem "rake", ">= 0.8.7" gem "mocha", ">= 0.9.8" -gem "ruby-debug", ">= 0.10.3" if RUBY_VERSION < '1.9' -gem "rails", "3.0.pre", :path => "railties" -%w(activesupport activemodel actionpack actionmailer activerecord activeresource).each do |lib| - gem lib, '3.0.pre', :path => lib +if RUBY_VERSION < '1.9' + gem "ruby-debug", ">= 0.10.3" end # AR gem "arel", ">= 0.2.0" gem "sqlite3-ruby", ">= 1.2.5" -only :test do +group :test do gem "pg", ">= 0.8.0" gem "mysql", ">= 2.8.1" end @@ -21,8 +24,6 @@ gem "rack-test", "0.5.3" gem "RedCloth", ">= 4.2.2" if ENV['CI'] - disable_system_gems - gem "nokogiri", ">= 1.4.0" gem "memcache-client", ">= 1.7.6" @@ -34,5 +35,3 @@ if ENV['CI'] gem "test-unit", ">= 2.0.5" end end - -disable_system_gems diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index ce09bb5d61..8fb941f9c9 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -1,12 +1,5 @@ -begin - require File.expand_path('../../../vendor/gems/environment', __FILE__) -rescue LoadError -end - -lib = File.expand_path('../../lib', __FILE__) -$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) +require File.expand_path('../../../load_paths', __FILE__) -require 'rubygems' require 'test/unit' require 'action_mailer' diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 7b04638ccc..867e50d5b9 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -1,10 +1,4 @@ -begin - require File.expand_path('../../../vendor/gems/environment', __FILE__) -rescue LoadError -end - -lib = File.expand_path('../../lib', __FILE__) -$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) +require File.expand_path('../../../load_paths', __FILE__) $:.unshift(File.dirname(__FILE__) + '/lib') $:.unshift(File.dirname(__FILE__) + '/fixtures/helpers') @@ -20,9 +14,6 @@ require 'action_view/base' require 'action_dispatch' require 'fixture_template' require 'active_support/dependencies' - -activemodel_path = File.expand_path('../../../activemodel/lib', __FILE__) -$:.unshift(activemodel_path) if File.directory?(activemodel_path) && !$:.include?(activemodel_path) require 'active_model' begin diff --git a/activemodel/test/cases/helper.rb b/activemodel/test/cases/helper.rb index 917bb720d0..8bcbe54651 100644 --- a/activemodel/test/cases/helper.rb +++ b/activemodel/test/cases/helper.rb @@ -1,10 +1,4 @@ -begin - require File.expand_path('../../../../vendor/gems/environment', __FILE__) -rescue LoadError -end - -lib = File.expand_path('../../../lib', __FILE__) -$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) +require File.expand_path('../../../../load_paths', __FILE__) require 'config' require 'active_model' diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index fa76e2d57a..9e8bfbbee8 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -1,14 +1,7 @@ -begin - require File.expand_path('../../../../vendor/gems/environment', __FILE__) -rescue LoadError -end - -lib = File.expand_path('../../../lib', __FILE__) -$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) +require File.expand_path('../../../../load_paths', __FILE__) require 'config' -require 'rubygems' require 'test/unit' require 'stringio' diff --git a/activeresource/test/abstract_unit.rb b/activeresource/test/abstract_unit.rb index 1e71d5d0dd..2f43916521 100644 --- a/activeresource/test/abstract_unit.rb +++ b/activeresource/test/abstract_unit.rb @@ -1,10 +1,4 @@ -begin - require File.expand_path('../../../vendor/gems/environment', __FILE__) -rescue LoadError -end - -lib = File.expand_path('../../lib', __FILE__) -$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) +require File.expand_path('../../../load_paths', __FILE__) require 'rubygems' require 'test/unit' diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index d91e0415c4..33be6f65bf 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -1,12 +1,4 @@ -ORIG_ARGV = ARGV.dup - -begin - require File.expand_path('../../../vendor/gems/environment', __FILE__) -rescue LoadError -end - -lib = File.expand_path("#{File.dirname(__FILE__)}/../lib") -$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) +require File.expand_path('../../../load_paths', __FILE__) require 'test/unit' require 'mocha' diff --git a/load_paths.rb b/load_paths.rb new file mode 100644 index 0000000000..55e2a530bd --- /dev/null +++ b/load_paths.rb @@ -0,0 +1,21 @@ +begin + require File.expand_path('../vendor/environment', __FILE__) +rescue LoadError + begin + require 'rubygems' + require 'bundler' + Bundler.setup + rescue LoadError + %w( + actionmailer + actionpack + activemodel + activerecord + activeresource + activesupport + railties + ).each do |framework| + $:.unshift File.expand_path("../#{framework}/lib", __FILE__) + end + end +end
\ No newline at end of file diff --git a/railties/Rakefile b/railties/Rakefile index b8f5e81b85..ea0b8ef8fb 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -1,7 +1,4 @@ -begin - require File.expand_path('../../vendor/gems/environment', __FILE__) -rescue LoadError -end +require File.expand_path('../../load_paths', __FILE__) require 'rake' require 'rake/testtask' 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 |