Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Autoload AR test case

  • Loading branch information...
commit e5ed62deea3f281f9dafc8e7c9ae4354b5ad6a27 1 parent 640d9e7
@josh josh authored
View
1  actionpack/test/active_record_unit.rb
@@ -17,7 +17,6 @@ class ActiveRecordTestConnector
raise LoadError, "#{PATH_TO_AR} doesn't exist" unless File.directory?(PATH_TO_AR)
$LOAD_PATH.unshift PATH_TO_AR
require 'active_record'
- require 'active_record/fixtures'
rescue LoadError => e
$stderr.print "Failed to load Active Record. Skipping Active Record assertion tests: #{e}"
ActiveRecordTestConnector.able_to_connect = false
View
2  activemodel/test/cases/tests_database.rb
@@ -2,8 +2,6 @@
$:.unshift(File.dirname(__FILE__) + '/../../../activerecord/lib')
require 'active_record'
-require 'active_record/test_case'
-require 'active_record/fixtures'
module ActiveModel
module TestsDatabase
View
3  activerecord/lib/active_record.rb
@@ -134,6 +134,9 @@ module ConnectionAdapters
autoload :AbstractAdapter
end
end
+
+ autoload :TestCase
+ autoload :TestFixtures, 'active_record/fixtures'
end
Arel::Table.engine = Arel::Sql::Engine.new(ActiveRecord::Base)
View
5 activerecord/lib/active_record/railties/databases.rake
@@ -46,7 +46,7 @@ namespace :db do
$stderr.puts "Couldn't create database for #{config.inspect}"
end
end
- return # Skip the else clause of begin/rescue
+ return # Skip the else clause of begin/rescue
else
ActiveRecord::Base.establish_connection(config)
ActiveRecord::Base.connection
@@ -245,7 +245,6 @@ namespace :db do
namespace :fixtures do
desc "Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
task :load => :environment do
- require 'active_record/fixtures'
ActiveRecord::Base.establish_connection(Rails.env)
base_dir = ENV['FIXTURES_PATH'] ? File.join(Rails.root, ENV['FIXTURES_PATH']) : File.join(Rails.root, 'test', 'fixtures')
fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
@@ -257,8 +256,6 @@ namespace :db do
desc "Search for a fixture given a LABEL or ID. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
task :identify => :environment do
- require "active_record/fixtures"
-
label, id = ENV["LABEL"], ENV["ID"]
raise "LABEL or ID required" if label.blank? && id.blank?
View
2  activerecord/test/cases/helper.rb
@@ -13,8 +13,6 @@
require 'stringio'
require 'active_record'
-require 'active_record/test_case'
-require 'active_record/fixtures'
require 'connection'
begin
View
3  railties/lib/rails/test_help.rb
@@ -9,9 +9,6 @@
require 'active_support/core_ext/kernel/requires'
if defined?(ActiveRecord)
- require 'active_record/test_case'
- require 'active_record/fixtures'
-
class ActiveSupport::TestCase
include ActiveRecord::TestFixtures
self.fixture_path = "#{Rails.root}/test/fixtures/"
Please sign in to comment.
Something went wrong with that request. Please try again.