diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-13 19:05:54 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-13 19:05:54 +0000 |
commit | effe522515e160349feb4a5414195aec04664e75 (patch) | |
tree | c8bb1067e0008b62d87a3f9f378485909ce52847 /activerecord | |
parent | 6627b828a16ff922343cd3bd2c307600d588c493 (diff) | |
download | rails-effe522515e160349feb4a5414195aec04664e75.tar.gz rails-effe522515e160349feb4a5414195aec04664e75.tar.bz2 rails-effe522515e160349feb4a5414195aec04664e75.zip |
r3577@sedna: jeremy | 2005-10-13 11:55:20 -0700
Add in_memory_connection for SQLite3 AR tests. Uses :dbfile => ':memory:' so we don't have to manage db files. It seems a bit quirky, so I'm including it as a separate connection type until we iron out the details.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2556 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/connections/native_sqlite3/in_memory_connection.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/connections/native_sqlite3/in_memory_connection.rb b/activerecord/test/connections/native_sqlite3/in_memory_connection.rb new file mode 100644 index 0000000000..d11a5fe8c8 --- /dev/null +++ b/activerecord/test/connections/native_sqlite3/in_memory_connection.rb @@ -0,0 +1,17 @@ +print "Using native SQLite3\n" +require 'fixtures/course' +require 'logger' +ActiveRecord::Base.logger = Logger.new("debug.log") + +class SqliteError < StandardError +end + +def make_connection(clazz, db_definitions_file) + clazz.establish_connection(:adapter => 'sqlite3', :dbfile => ':memory:') + File.read("#{File.dirname(__FILE__)}/../../fixtures/db_definitions/#{db_definitions_file}").split(';').each do |command| + clazz.connection.execute(command) unless command.strip.empty? + end +end + +make_connection(ActiveRecord::Base, 'sqlite.sql') +make_connection(Course, 'sqlite2.sql') |