aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-02-17 19:28:13 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-02-17 19:28:13 +0000
commitbc574a86ac3b19108341af9deb2d23609d44d5c0 (patch)
tree366dda7bce4fc06881ff08aaae595c186734fc18 /activerecord/test
parentea3faf3df9c13b8e4b0a6553da676099e92abc4f (diff)
downloadrails-bc574a86ac3b19108341af9deb2d23609d44d5c0.tar.gz
rails-bc574a86ac3b19108341af9deb2d23609d44d5c0.tar.bz2
rails-bc574a86ac3b19108341af9deb2d23609d44d5c0.zip
Skip Active Record tests in Action Pack if the SQLite database cant be brought up
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@652 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/abstract_unit.rb1
-rw-r--r--activerecord/test/connections/native_sqlite/connection.rb5
-rw-r--r--activerecord/test/connections/native_sqlite3/connection.rb6
3 files changed, 9 insertions, 3 deletions
diff --git a/activerecord/test/abstract_unit.rb b/activerecord/test/abstract_unit.rb
index dbab4b0e80..c798383e6d 100755
--- a/activerecord/test/abstract_unit.rb
+++ b/activerecord/test/abstract_unit.rb
@@ -1,4 +1,5 @@
$:.unshift(File.dirname(__FILE__) + '/../lib')
+$:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
require 'test/unit'
require 'active_record'
diff --git a/activerecord/test/connections/native_sqlite/connection.rb b/activerecord/test/connections/native_sqlite/connection.rb
index db688bdb70..e702006bc2 100644
--- a/activerecord/test/connections/native_sqlite/connection.rb
+++ b/activerecord/test/connections/native_sqlite/connection.rb
@@ -3,6 +3,9 @@ require 'fixtures/course'
require 'logger'
ActiveRecord::Base.logger = Logger.new("debug.log")
+class SqliteError < StandardError
+end
+
BASE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../fixtures')
sqlite_test_db = "#{BASE_DIR}/fixture_database.sqlite"
sqlite_test_db2 = "#{BASE_DIR}/fixture_database_2.sqlite"
@@ -12,7 +15,7 @@ def make_connection(clazz, db_file, db_definitions_file)
puts "SQLite database not found at #{db_file}. Rebuilding it."
sqlite_command = "sqlite #{db_file} 'create table a (a integer); drop table a;'"
puts "Executing '#{sqlite_command}'"
- `#{sqlite_command}`
+ raise SqliteError.new("Seems that there is no sqlite executable available") unless system(sqlite_command)
clazz.establish_connection(
:adapter => "sqlite",
:dbfile => db_file)
diff --git a/activerecord/test/connections/native_sqlite3/connection.rb b/activerecord/test/connections/native_sqlite3/connection.rb
index 573d942716..640a2b97f5 100644
--- a/activerecord/test/connections/native_sqlite3/connection.rb
+++ b/activerecord/test/connections/native_sqlite3/connection.rb
@@ -2,7 +2,9 @@ print "Using native SQLite3\n"
require 'fixtures/course'
require 'logger'
ActiveRecord::Base.logger = Logger.new("debug.log")
-ActiveRecord::Base.logger.level = Logger::DEBUG
+
+class SqliteError < StandardError
+end
BASE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../fixtures')
sqlite_test_db = "#{BASE_DIR}/fixture_database.sqlite3"
@@ -13,7 +15,7 @@ def make_connection(clazz, db_file, db_definitions_file)
puts "SQLite3 database not found at #{db_file}. Rebuilding it."
sqlite_command = "sqlite3 #{db_file} 'create table a (a integer); drop table a;'"
puts "Executing '#{sqlite_command}'"
- `#{sqlite_command}`
+ raise SqliteError.new("Seems that there is no sqlite3 executable available") unless system(sqlite_command)
clazz.establish_connection(
:adapter => "sqlite3",
:dbfile => db_file)