aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/helper.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-06-04 23:19:17 +0100
committerJon Leighton <j@jonathanleighton.com>2011-06-04 23:47:03 +0100
commit253bb6b9260938ed673e2c0059d729cffff4a523 (patch)
treecf8aa429645a0c73d32e8fe0eecf62a536488bdd /activerecord/test/cases/helper.rb
parentcdce7ff191313bd99a31d26ddca5a5c8be766695 (diff)
downloadrails-253bb6b9260938ed673e2c0059d729cffff4a523.tar.gz
rails-253bb6b9260938ed673e2c0059d729cffff4a523.tar.bz2
rails-253bb6b9260938ed673e2c0059d729cffff4a523.zip
Refactor Active Record test connection setup. Please see the RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
Diffstat (limited to 'activerecord/test/cases/helper.rb')
-rw-r--r--activerecord/test/cases/helper.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb
index 9644ac1b02..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