diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-06-09 20:15:34 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-06-09 20:20:51 +0100 |
commit | 4b371b602b61cae5c3eed0ed6a5a2b0f92e4bbaf (patch) | |
tree | d6efbdf4a26bf0313a633573ff008eb2c9f1ccf4 /activerecord | |
parent | e48829946d4002f6baffef21f401684d43ab9a35 (diff) | |
download | rails-4b371b602b61cae5c3eed0ed6a5a2b0f92e4bbaf.tar.gz rails-4b371b602b61cae5c3eed0ed6a5a2b0f92e4bbaf.tar.bz2 rails-4b371b602b61cae5c3eed0ed6a5a2b0f92e4bbaf.zip |
Print out information about whether the identity map is on or off when running unit tests
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/RUNNING_UNIT_TESTS | 7 | ||||
-rw-r--r-- | activerecord/test/cases/helper.rb | 11 | ||||
-rw-r--r-- | activerecord/test/support/connection.rb | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/activerecord/RUNNING_UNIT_TESTS b/activerecord/RUNNING_UNIT_TESTS index 9dc4b91d26..8fe9a357b4 100644 --- a/activerecord/RUNNING_UNIT_TESTS +++ b/activerecord/RUNNING_UNIT_TESTS @@ -25,3 +25,10 @@ You can run all the tests for a given database via rake: $ rake test_mysql The 'rake test' task will run all the tests for mysql, mysql2, sqlite3 and postgresql. + +== Identity Map + +By default the tests run with the Identity Map turned off. But all tests should pass whether or +not the identity map is on or off. You can turn it on using the IM env variable: + + $ IM=true ruby -Itest test/case/base_test.rb diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 110f6b97c6..d0dc9cb03d 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -12,19 +12,20 @@ require 'active_support/dependencies' require 'support/config' require 'support/connection' -ARTest.connect - # TODO: Move all these random hacks into the ARTest namespace and into the support/ dir # Show backtraces for deprecated behavior for quicker cleanup. ActiveSupport::Deprecation.debug = true -# Quote "type" if it's a reserved word for the current connection. -QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name('type') - # Enable Identity Map only when ENV['IM'] is set to "true" ActiveRecord::IdentityMap.enabled = (ENV['IM'] == "true") +# Connect to the database +ARTest.connect + +# Quote "type" if it's a reserved word for the current connection. +QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name('type') + def current_adapter?(*types) types.any? do |type| ActiveRecord::ConnectionAdapters.const_defined?(type) && diff --git a/activerecord/test/support/connection.rb b/activerecord/test/support/connection.rb index fcd2e4dee5..a39794fa39 100644 --- a/activerecord/test/support/connection.rb +++ b/activerecord/test/support/connection.rb @@ -11,7 +11,7 @@ module ARTest end def self.connect - puts "Using #{connection_name}" + puts "Using #{connection_name} with Identity Map #{ActiveRecord::IdentityMap.enabled? ? 'on' : 'off'}" ActiveRecord::Base.logger = Logger.new("debug.log") ActiveRecord::Base.configurations = connection_config ActiveRecord::Base.establish_connection 'arunit' |