Skip to content

Commit

Permalink
Pass busy timeout for sqlite3 integration tests.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6029 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Jan 24, 2007
1 parent bb778fc commit f08bd27
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions actionpack/test/active_record_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit f08bd27

Please sign in to comment.