diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-08 18:36:30 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-11 13:45:06 -0800 |
commit | c47c54140246f4e5b49376ae9c408c85968ed6c3 (patch) | |
tree | 0299c64e185c2980c5dda47dbcc9a59bf1398918 /activerecord/test/connections/native_sqlite3_mem | |
parent | 80df74bf515124c9db85d4a670989ae5cc28c3ec (diff) | |
download | rails-c47c54140246f4e5b49376ae9c408c85968ed6c3.tar.gz rails-c47c54140246f4e5b49376ae9c408c85968ed6c3.tar.bz2 rails-c47c54140246f4e5b49376ae9c408c85968ed6c3.zip |
Have a separate test connection directory for sqlite3 in-memory so that the tests can be run without having to specifically rename the connection file (which then causes git to pick up the changes)
Diffstat (limited to 'activerecord/test/connections/native_sqlite3_mem')
-rw-r--r-- | activerecord/test/connections/native_sqlite3_mem/connection.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/activerecord/test/connections/native_sqlite3_mem/connection.rb b/activerecord/test/connections/native_sqlite3_mem/connection.rb new file mode 100644 index 0000000000..14e10900d1 --- /dev/null +++ b/activerecord/test/connections/native_sqlite3_mem/connection.rb @@ -0,0 +1,19 @@ +# This file connects to an in-memory SQLite3 database, which is a very fast way to run the tests. +# The downside is that disconnect from the database results in the database effectively being +# wiped. For this reason, pooled_connections_test.rb is disabled when using an in-memory database. + +print "Using native SQLite3 (in memory)\n" +require_dependency 'models/course' +require 'logger' +ActiveRecord::Base.logger = Logger.new("debug.log") + +class SqliteError < StandardError +end + +def make_connection(clazz) + ActiveRecord::Base.configurations = { clazz.name => { :adapter => 'sqlite3', :database => ':memory:' } } + clazz.establish_connection(clazz.name) +end + +make_connection(ActiveRecord::Base) +make_connection(Course) |