mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove fixtures from Test::Unit::TestCase. Mix in AR::TestFixtures instead.
This commit is contained in:
parent
d355921709
commit
b0ee1bdf26
3 changed files with 188 additions and 186 deletions
|
@ -813,9 +813,10 @@ class Fixture #:nodoc:
|
|||
end
|
||||
end
|
||||
|
||||
module Test #:nodoc:
|
||||
module Unit #:nodoc:
|
||||
class TestCase #:nodoc:
|
||||
module ActiveRecord
|
||||
module TestFixtures
|
||||
def self.included(base)
|
||||
base.class_eval do
|
||||
setup :setup_fixtures
|
||||
teardown :teardown_fixtures
|
||||
|
||||
|
@ -833,8 +834,12 @@ module Test #:nodoc:
|
|||
|
||||
@@already_loaded_fixtures = {}
|
||||
self.fixture_class_names = {}
|
||||
end
|
||||
|
||||
class << self
|
||||
base.extend ClassMethods
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def set_fixture_class(class_names = {})
|
||||
self.fixture_class_names = self.fixture_class_names.merge(class_names)
|
||||
end
|
||||
|
@ -995,4 +1000,3 @@ module Test #:nodoc:
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
require "active_support/test_case"
|
||||
require "active_record/fixtures"
|
||||
|
||||
module ActiveRecord
|
||||
class TestCase < ActiveSupport::TestCase #:nodoc:
|
||||
include TestFixtures
|
||||
|
||||
self.fixture_path = FIXTURES_ROOT
|
||||
self.use_instantiated_fixtures = false
|
||||
self.use_transactional_fixtures = true
|
||||
|
|
|
@ -5,7 +5,6 @@ require 'config'
|
|||
require 'test/unit'
|
||||
|
||||
require 'active_record'
|
||||
require 'active_record/fixtures'
|
||||
require 'active_record/test_case'
|
||||
require 'connection'
|
||||
|
||||
|
@ -48,9 +47,7 @@ class << ActiveRecord::Base
|
|||
end
|
||||
|
||||
unless ENV['FIXTURE_DEBUG']
|
||||
module Test #:nodoc:
|
||||
module Unit #:nodoc:
|
||||
class << TestCase #:nodoc:
|
||||
module ActiveRecord::TestFixtures::ClassMethods
|
||||
def try_to_load_dependency_with_silence(*args)
|
||||
ActiveRecord::Base.logger.silence { try_to_load_dependency_without_silence(*args)}
|
||||
end
|
||||
|
@ -58,5 +55,3 @@ unless ENV['FIXTURE_DEBUG']
|
|||
alias_method_chain :try_to_load_dependency, :silence
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue