diff options
Diffstat (limited to 'activerecord/test/cases/helper.rb')
-rw-r--r-- | activerecord/test/cases/helper.rb | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index fbb4ee6f7b..7a214fa75a 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -1,5 +1,8 @@ require File.expand_path('../../../../load_paths', __FILE__) +test = File.expand_path('../..', __FILE__) +$:.unshift(test) unless $:.include?('test') || $:.include?(test) + lib = File.expand_path("#{File.dirname(__FILE__)}/../../lib") $:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) @@ -11,14 +14,13 @@ require 'mocha' require 'active_record' require 'active_support/dependencies' -begin - require 'connection' -rescue LoadError - # If we cannot load connection we assume that driver was not loaded for this test case, so we load sqlite3 as default one. - # This allows for running separate test cases by simply running test file. - connection_type = defined?(JRUBY_VERSION) ? 'jdbc' : 'native' - require "test/connections/#{connection_type}_sqlite3/connection" -end + +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 @@ -26,8 +28,8 @@ 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 for testing -ActiveRecord::IdentityMap.enabled = (ENV['IM'] == "false" ? false : true) +# Enable Identity Map only when ENV['IM'] is set to "true" +ActiveRecord::IdentityMap.enabled = (ENV['IM'] == "true") def current_adapter?(*types) types.any? do |type| |