mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fixtures :models will now also attempt to include the model.rb file
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@153 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
68d1056587
commit
bc1aa7d9fd
3 changed files with 12 additions and 4 deletions
|
@ -301,9 +301,20 @@ class Test::Unit::TestCase #:nodoc:
|
|||
cattr_accessor :fixture_table_names
|
||||
|
||||
def self.fixtures(*table_names)
|
||||
require_fixture_classes(table_names)
|
||||
write_inheritable_attribute("fixture_table_names", table_names)
|
||||
end
|
||||
|
||||
def self.require_fixture_classes(table_names)
|
||||
table_names.each do |table_name|
|
||||
begin
|
||||
require(Inflector.singularize(table_name.to_s))
|
||||
rescue LoadError
|
||||
# Let's hope the developer is included it himself
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def setup
|
||||
instantiate_fixtures(*fixture_table_names) if fixture_table_names
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
||||
# $:.unshift(File.dirname(__FILE__) + '/fixtures')
|
||||
|
||||
require 'test/unit'
|
||||
require 'active_record'
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
require 'abstract_unit'
|
||||
require 'fixtures/topic'
|
||||
require 'fixtures/reply'
|
||||
require 'fixtures/developer'
|
||||
|
||||
|
||||
class ValidationsTest < Test::Unit::TestCase
|
||||
fixtures :topics, :developers
|
||||
|
|
Loading…
Reference in a new issue