Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Pass busy timeout for sqlite3 integration tests.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6029 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit f08bd27398f11420a2bae5ac0be5f169650683a6 1 parent bb778fc
@jeremy jeremy authored
Showing with 9 additions and 8 deletions.
  1. +9 −8 actionpack/test/active_record_unit.rb
View
17 actionpack/test/active_record_unit.rb
@@ -51,22 +51,23 @@ def setup
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 @@ def require_fixture_models
end
end
-# Test case for inheiritance
+# Test case for inheritance
class ActiveRecordTestCase < Test::Unit::TestCase
# Set our fixture path
if ActiveRecordTestConnector.able_to_connect
Please sign in to comment.
Something went wrong with that request. Please try again.