aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/RUNNING_UNIT_TESTS7
-rw-r--r--activerecord/test/cases/helper.rb11
-rw-r--r--activerecord/test/support/connection.rb2
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'