mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Setting fixtures automatically for integration tests is a bit harder -- will have to wait until the test superclass reform is implemented
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6228 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
87b7b5b3e7
commit
23e24c5996
2 changed files with 5 additions and 0 deletions
|
@ -490,10 +490,12 @@ module Test #:nodoc:
|
|||
def self.setup_fixture_accessors(table_names=nil)
|
||||
(table_names || fixture_table_names).each do |table_name|
|
||||
table_name = table_name.to_s.tr('.','_')
|
||||
|
||||
define_method(table_name) do |fixture, *optionals|
|
||||
force_reload = optionals.shift
|
||||
@fixture_cache[table_name] ||= Hash.new
|
||||
@fixture_cache[table_name][fixture] = nil if force_reload
|
||||
|
||||
if @loaded_fixtures[table_name][fixture.to_s]
|
||||
@fixture_cache[table_name][fixture] ||= @loaded_fixtures[table_name][fixture.to_s].find
|
||||
else
|
||||
|
|
|
@ -27,6 +27,9 @@ class Test::Unit::TestCase
|
|||
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
||||
# If you need to control the loading order (due to foreign key constraints etc), you'll
|
||||
# need to change this line to explicitly name the order you desire.
|
||||
#
|
||||
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
||||
# -- they do not yet inherent this setting
|
||||
fixtures :all
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
|
|
Loading…
Reference in a new issue