diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-24 16:45:33 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-24 16:45:33 +0000 |
commit | f57ba4cc5237b408e23715ab6c7d700bd8e125b0 (patch) | |
tree | 0ff766a1adef059bfc417c93441d1a134a1d9735 /activerecord/lib/active_record | |
parent | 0e4c5b0288c3fab5ec8bdc4d7448be2b72e55e58 (diff) | |
download | rails-f57ba4cc5237b408e23715ab6c7d700bd8e125b0.tar.gz rails-f57ba4cc5237b408e23715ab6c7d700bd8e125b0.tar.bz2 rails-f57ba4cc5237b408e23715ab6c7d700bd8e125b0.zip |
r2727@asus: jeremy | 2005-10-24 14:14:36 -0700
Fallback to @loaded_fixtures = {}. Use Logger#silence. Test fixture isolation with use_instantiated_fixtures and with no fixtures declaration.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2719 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/fixtures.rb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 66c7feee48..260c3f97b1 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -217,19 +217,16 @@ class Fixtures < YAML::Omap DEFAULT_FILTER_RE = /\.ya?ml$/ def self.instantiate_fixtures(object, table_name, fixtures, load_instances=true) - old_logger_level = ActiveRecord::Base.logger.level - ActiveRecord::Base.logger.level = Logger::ERROR - object.instance_variable_set "@#{table_name.to_s.gsub('.','_')}", fixtures if load_instances - fixtures.each do |name, fixture| - if model = fixture.find - object.instance_variable_set "@#{name}", model + ActiveRecord::Base.logger.silence do + fixtures.each do |name, fixture| + if model = fixture.find + object.instance_variable_set "@#{name}", model + end end end end - - ActiveRecord::Base.logger.level = old_logger_level end def self.instantiate_all_loaded_fixtures(object, load_instances=true) @@ -558,7 +555,7 @@ module Test #:nodoc: def reload_fixtures! # Clear dirty fixtures and loaded fixtures which were not declared # for this test case. - wipe = dirty_fixture_table_names + loaded_fixture_table_names - fixture_table_names + wipe = dirty_fixture_table_names | loaded_fixture_table_names - fixture_table_names Fixtures.delete_fixtures(wipe) unless wipe.empty? dirty_fixture_table_names.clear loaded_fixture_table_names.clear @@ -573,6 +570,8 @@ module Test #:nodoc: @loaded_fixtures[f.table_name] = f f.table_name.to_s } + else + @loaded_fixtures = {} end end |