From f08bd27398f11420a2bae5ac0be5f169650683a6 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 24 Jan 2007 12:02:40 +0000 Subject: Pass busy timeout for sqlite3 integration tests. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6029 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/active_record_unit.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/active_record_unit.rb b/actionpack/test/active_record_unit.rb index fd29126354..5f2745b593 100644 --- a/actionpack/test/active_record_unit.rb +++ b/actionpack/test/active_record_unit.rb @@ -51,22 +51,23 @@ class ActiveRecordTestConnector def setup_connection if Object.const_defined?(:ActiveRecord) + defaults = { :database => ':memory:' } begin - connection_options = {:adapter => 'sqlite3', :dbfile => ':memory:'} - ActiveRecord::Base.establish_connection(connection_options) - ActiveRecord::Base.configurations = { 'sqlite3_ar_integration' => connection_options } + options = defaults.merge :adapter => 'sqlite3', :timeout => 500 + ActiveRecord::Base.establish_connection(options) + ActiveRecord::Base.configurations = { 'sqlite3_ar_integration' => options } ActiveRecord::Base.connection rescue Exception # errors from establishing a connection $stderr.puts 'SQLite 3 unavailable; trying SQLite 2.' - connection_options = {:adapter => 'sqlite', :dbfile => ':memory:'} - ActiveRecord::Base.establish_connection(connection_options) - ActiveRecord::Base.configurations = { 'sqlite2_ar_integration' => connection_options } + options = defaults.merge :adapter => 'sqlite' + ActiveRecord::Base.establish_connection(options) + ActiveRecord::Base.configurations = { 'sqlite2_ar_integration' => options } ActiveRecord::Base.connection end Object.send(:const_set, :QUOTED_TYPE, ActiveRecord::Base.connection.quote_column_name('type')) unless Object.const_defined?(:QUOTED_TYPE) else - raise "Couldn't locate ActiveRecord." + raise "Can't setup connection since ActiveRecord isn't loaded." end end @@ -83,7 +84,7 @@ class ActiveRecordTestConnector end end -# Test case for inheiritance +# Test case for inheritance class ActiveRecordTestCase < Test::Unit::TestCase # Set our fixture path if ActiveRecordTestConnector.able_to_connect -- cgit v1.2.3