diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-12-20 16:13:34 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-12-20 16:13:34 -0800 |
commit | fbb79b517f3127ba620fedd01849f9628b78d6ce (patch) | |
tree | 76d127dc18bf93016d4bb59b813fa5c308d594c8 /activerecord/test/cases/adapters/sqlite3 | |
parent | d0ffa7f8535dc343bb8a421520ea32d8e8be916f (diff) | |
download | rails-fbb79b517f3127ba620fedd01849f9628b78d6ce.tar.gz rails-fbb79b517f3127ba620fedd01849f9628b78d6ce.tar.bz2 rails-fbb79b517f3127ba620fedd01849f9628b78d6ce.zip |
fix url connections for sqlite3
Diffstat (limited to 'activerecord/test/cases/adapters/sqlite3')
-rw-r--r-- | activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb index ce7c869eec..48ffbd1103 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb @@ -1,6 +1,7 @@ # encoding: utf-8 require "cases/helper" require 'models/owner' +require 'tempfile' module ActiveRecord module ConnectionAdapters @@ -25,6 +26,27 @@ module ActiveRecord ActiveSupport::Notifications.subscribe('sql.active_record', @subscriber) end + def test_connect_with_url + original_connection = ActiveRecord::Base.remove_connection + tf = Tempfile.open 'whatever' + url = "sqlite3://#{tf.path}" + ActiveRecord::Base.establish_connection(url) + assert ActiveRecord::Base.connection + ensure + tf.close + tf.unlink + ActiveRecord::Base.establish_connection(original_connection) + end + + def test_connect_memory_with_url + original_connection = ActiveRecord::Base.remove_connection + url = "sqlite3:///:memory:" + ActiveRecord::Base.establish_connection(url) + assert ActiveRecord::Base.connection + ensure + ActiveRecord::Base.establish_connection(original_connection) + end + def test_valid_column column = @conn.columns('items').find { |col| col.name == 'id' } assert @conn.valid_type?(column.type) |