Have all the tests running off a single Gemfile

This commit is contained in:
Yehuda Katz + Carl Lerche 2009-10-20 16:33:54 -07:00
parent a5c82a9dfb
commit 4f6d6f7031
18 changed files with 83 additions and 140 deletions

6
.gitignore vendored
View File

@ -27,10 +27,6 @@ railties/guides/output
*.rbc
*.swp
*.swo
actionpack/bin
activerecord/bin
bin
vendor/gems/
*/vendor/gems/
railties/tmp
activerecord/vendor
actionpack/vendor

21
Gemfile Normal file
View File

@ -0,0 +1,21 @@
Gem.sources.each { |uri| source uri }
gem "rails", "3.0.pre", :vendored_at => "railties"
%w(
activesupport
activemodel
actionpack
actionmailer
activerecord
activeresource
).each do |lib|
gem lib, '3.0.pre', :vendored_at => lib
end
gem "rack", "1.0.1"
gem "rack-mount", :git => "git://github.com/josh/rack-mount.git"
gem "rack-test", "~> 0.5.0"
gem "erubis", "~> 2.6.0"
gem "arel", :git => "git://github.com/rails/arel.git"
gem "mocha"
gem "sqlite3-ruby"
gem "RedCloth"

View File

@ -1,10 +0,0 @@
Gem.sources.each { |uri| source uri }
sibling = "#{File.dirname(__FILE__)}/.."
gem "activesupport", "3.0.pre", :vendored_at => "#{sibling}/activesupport"
gem "activemodel", "3.0.pre", :vendored_at => "#{sibling}/activemodel"
gem "actionpack", "3.0.pre", :vendored_at => "#{sibling}/actionpack"
gem "rack-mount", :git => "git://github.com/josh/rack-mount.git"
gem "mocha"
#disable_system_gems

View File

@ -1,15 +1,15 @@
bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment"
if File.exist?("#{bundled}.rb")
require bundled
else
$:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift "#{File.dirname(__FILE__)}/../../actionpack/lib"
root = File.expand_path('../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
rescue LoadError
$:.unshift("#{root}/activesupport/lib")
$:.unshift("#{root}/actionpack/lib")
$:.unshift("#{root}/actionmailer/lib")
end
require 'rubygems'
require 'test/unit'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'action_mailer'
require 'action_mailer/test_case'

View File

@ -1,18 +0,0 @@
rails_root = Pathname.new(File.dirname(__FILE__)).join("..")
Gem.sources.each { |uri| source uri }
gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git", :branch => "rack-1.0"
gem "rack-mount", :git => "git://github.com/josh/rack-mount.git"
gem "rack-test", "~> 0.5.0"
gem "activesupport", "3.0.pre", :vendored_at => rails_root.join("activesupport")
gem "activemodel", "3.0.pre", :vendored_at => rails_root.join("activemodel")
gem "arel", :git => "git://github.com/rails/arel.git"
gem "activerecord", "3.0.pre", :vendored_at => rails_root.join("activerecord")
gem "erubis", "~> 2.6.0"
gem "mocha"
gem "sqlite3-ruby"
gem "RedCloth"
disable_system_gems

View File

@ -1,13 +1,12 @@
bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment"
if File.exist?("#{bundled}.rb")
require bundled
else
$:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift "#{File.dirname(__FILE__)}/../../activemodel/lib"
root = File.expand_path('../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
rescue LoadError
$:.unshift "#{root}/activesupport/lib"
$:.unshift "#{root}/activemodel/lib"
$:.unshift "#{root}/lib"
end
$:.unshift(File.dirname(__FILE__) + '/../lib')
$:.unshift(File.dirname(__FILE__) + '/lib')
$:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
$:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers')

View File

@ -1,12 +0,0 @@
rails_root = Pathname.new(File.dirname(__FILE__)).join("..")
Gem.sources.each { |uri| source uri }
gem "activesupport", "3.0.pre", :vendored_at => rails_root.join("activesupport")
gem "arel", :git => "git://github.com/rails/arel.git"
only :test do
gem "sqlite3-ruby"
end
disable_system_gems

View File

@ -1,13 +1,12 @@
bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment"
if File.exist?("#{bundled}.rb")
require bundled
else
$:.unshift(File.dirname(__FILE__) + '/../../lib')
$:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib')
root = File.expand_path('../../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
rescue LoadError
$:.unshift("#{root}/activesupport/lib")
$:.unshift("#{root}/activemodel/lib")
end
require 'config'
require 'active_model'
# Show backtraces for deprecated behavior for quicker cleanup.

View File

@ -1,8 +0,0 @@
Gem.sources.each { |uri| source uri }
sibling = "#{File.dirname(__FILE__)}/.."
gem "activesupport", "3.0.pre", :vendored_at => "#{sibling}/activesupport"
gem "activemodel", "3.0.pre", :vendored_at => "#{sibling}/activemodel"
gem "arel", :git => "git://github.com/rails/arel.git"
gem "mocha"

View File

@ -1,10 +1,9 @@
$:.unshift(File.dirname(__FILE__) + '/../../lib')
bundled = "#{File.dirname(__FILE__)}/../../vendor/gems/environment"
if File.exist?("#{bundled}.rb")
require bundled
else
$:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib')
root = File.expand_path('../../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
rescue LoadError
$:.unshift("#{root}/activesupport/lib")
$:.unshift("#{root}/activerecord/lib")
end
require 'config'

View File

@ -1,9 +1,15 @@
root = File.expand_path('../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
rescue LoadError
$:.unshift("#{root}/activesupport/lib")
$:.unshift("#{root}/activeresource/lib")
end
require 'rubygems'
require 'test/unit'
require 'active_support'
require 'active_support/test_case'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_resource'
$:.unshift "#{File.dirname(__FILE__)}/../test"

View File

@ -1,5 +1,3 @@
require "active_support/core_ext/load_error"
module ActiveSupport
module Testing
class ProxyTestResult

View File

@ -1,3 +1,5 @@
require 'pathname'
def ActiveSupport.requirable?(file)
$LOAD_PATH.any? { |p| Dir.glob("#{p}/#{file}.*").any? }
end
@ -10,7 +12,8 @@ end
gem lib, "~> #{version}"
# Use the vendored lib if the gem's missing or we aren't using RubyGems.
rescue LoadError, NoMethodError
$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/vendor/#{lib}-#{version}/lib")
# There could be symlinks
$LOAD_PATH.unshift Pathname.new(__FILE__).dirname.join("vendor/#{lib}-#{version}/lib").realpath.to_s
end
end
end

View File

@ -1,4 +1,12 @@
ORIG_ARGV = ARGV.dup
root = File.expand_path('../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
rescue LoadError
$:.unshift("#{root}/activesupport/lib")
$:.unshift("#{root}/activerecord/lib")
end
require 'test/unit'
@ -11,7 +19,6 @@ rescue LoadError
end
ENV['NO_RELOAD'] = '1'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_support'
require 'active_support/test_case'

View File

@ -1,13 +0,0 @@
Gem.sources.each { |uri| source uri }
sibling = "#{File.dirname(__FILE__)}/.."
gem "mocha"
gem "arel", :git => "git://github.com/rails/arel.git"
gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git", :branch => "rack-1.0"
gem "rack-mount", :git => "git://github.com/josh/rack-mount.git"
gem "rack-test", "~> 0.5.0"
%w(activesupport activemodel actionpack actionmailer activerecord activeresource).each do |lib|
gem lib, '3.0.pre', :vendored_at => "#{sibling}/#{lib}"
end

View File

@ -1,16 +1,15 @@
ORIG_ARGV = ARGV.dup
bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment"
if File.exist?("#{bundled}.rb")
require bundled
else
%w(activesupport activemodel activerecord actionpack actionmailer activeresource).each do |lib|
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../#{lib}/lib"
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 File.dirname(__FILE__) + "/../lib"
$:.unshift File.dirname(__FILE__) + "/../builtin/rails_info"
$:.unshift "#{root}/railties/builtin/rails_info"
require 'stringio'
require 'test/unit'

View File

@ -82,26 +82,6 @@ module ApplicationTests
end
end
test "action_pack is added to the load path if action_controller is required" do
Rails::Initializer.run do |config|
config.root = app_path
config.frameworks = [:action_controller]
end
Rails.initialize!
assert $:.include?("#{framework_path}/actionpack/lib")
end
test "action_pack is added to the load path if action_view is required" do
Rails::Initializer.run do |config|
config.root = app_path
config.frameworks = [:action_view]
end
Rails.initialize!
assert $:.include?("#{framework_path}/actionpack/lib")
end
test "after_initialize block works correctly" do
Rails::Initializer.run do |config|
config.root = app_path

View File

@ -6,7 +6,6 @@
#
# It is also good to know what is the bare minimum to get
# Rails booted up.
require 'fileutils'
# TODO: Remove rubygems when possible
@ -82,6 +81,7 @@ module TestHelpers
def build_app(options = {})
FileUtils.rm_rf(app_path)
FileUtils.cp_r(tmp_path('app_template'), app_path)
FileUtils.ln_s(RAILS_FRAMEWORK_ROOT, app_path('vendor/rails'))
# Delete the initializers unless requested
unless options[:initializers]
@ -114,13 +114,10 @@ module TestHelpers
end
def boot_rails
bundled = "#{File.dirname(__FILE__)}/../../vendor/gems/environment"
if File.exist?("#{bundled}.rb")
require bundled
%w(railties railties/lib).each do |path|
$LOAD_PATH.unshift File.expand_path("../../../../#{path}", __FILE__)
end
else
root = File.expand_path('../../../..', __FILE__)
begin
require "#{root}/vendor/gems/environment"
rescue LoadError
%w(
actionmailer/lib
actionpack/lib
@ -131,8 +128,7 @@ module TestHelpers
railties/lib
railties
).reverse_each do |path|
path = File.expand_path("../../../../#{path}", __FILE__)
$:.unshift(path)
$:.unshift "#{root}/#{path}"
end
end
end
@ -155,5 +151,6 @@ Module.new do
end
FileUtils.mkdir(tmp_path)
`#{Gem.ruby} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}`
root = File.expand_path('../../../..', __FILE__)
`#{Gem.ruby} -r #{root}/vendor/gems/environment #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}`
end