Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Get rails tests running on bundler 0.9

  • Loading branch information...
commit 9f01dff9c203821bf4ac6d7b885f1d6b018d5c79 1 parent 9bd0422
Carl Lerche authored
View
19 Gemfile
@@ -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
View
9 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'
View
11 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_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
View
8 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'
View
9 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'
View
8 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'
View
10 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'
View
21 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
View
5 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'
View
12 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'
View
26 railties/test/isolation/abstract_unit.rb
@@ -183,23 +183,7 @@ def use_frameworks(arr)
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 @@ class Test::Unit::TestCase
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
Please sign in to comment.
Something went wrong with that request. Please try again.